Skip to content
Snippets Groups Projects
Commit 24f23357 authored by Clinton Galbraith's avatar Clinton Galbraith
Browse files

Basic assest from a test made outside the repository, impotred to be constructed.

parent e28a5e1d
No related branches found
No related tags found
2 merge requests!8Develop,!3Feature physics
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1950246631194670}
m_IsPrefabParent: 1
--- !u!1 &1950246631194670
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4220641316261498}
- component: {fileID: 212720702365941542}
- component: {fileID: 58909280641846464}
- component: {fileID: 50714183746014120}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4220641316261498
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1950246631194670}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.68, y: 2.06, z: 0}
m_LocalScale: {x: 0.45533395, y: 0.45533395, z: 0.45533395}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &50714183746014120
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1950246631194670}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!58 &58909280641846464
CircleCollider2D:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1950246631194670}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 2.56
--- !u!212 &212720702365941542
SpriteRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1950246631194670}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 216c4c1a935737b46881baf3616eb67e, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.2, y: 0.2}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1699321193978672}
m_IsPrefabParent: 1
--- !u!1 &1227970671616358
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4478526762176916}
- component: {fileID: 212100727025334390}
- component: {fileID: 58925175005584528}
- component: {fileID: 50199550569727980}
- component: {fileID: 232019487599184054}
m_Layer: 0
m_Name: Player 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1699321193978672
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4833275979350124}
m_Layer: 0
m_Name: Players
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1954875215666954
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4533088468522244}
- component: {fileID: 212530743619791666}
- component: {fileID: 58141257560889648}
- component: {fileID: 50653538350569260}
- component: {fileID: 232860595527747538}
m_Layer: 0
m_Name: Player 2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4478526762176916
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1227970671616358}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.44, y: 0.69, z: 0}
m_LocalScale: {x: 0.45533395, y: 0.45533395, z: 0.45533395}
m_Children: []
m_Father: {fileID: 4833275979350124}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4533088468522244
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1954875215666954}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.23, y: 0.4, z: 0}
m_LocalScale: {x: 0.45533395, y: 0.45533395, z: 0.45533395}
m_Children: []
m_Father: {fileID: 4833275979350124}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4833275979350124
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1699321193978672}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.6001822, y: 1.9790664, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4478526762176916}
- {fileID: 4533088468522244}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &50199550569727980
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1227970671616358}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!50 &50653538350569260
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1954875215666954}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!58 &58141257560889648
CircleCollider2D:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1954875215666954}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 2.56
--- !u!58 &58925175005584528
CircleCollider2D:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1227970671616358}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 2.56
--- !u!212 &212100727025334390
SpriteRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1227970671616358}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 216c4c1a935737b46881baf3616eb67e, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.2, y: 0.2}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
--- !u!212 &212530743619791666
SpriteRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1954875215666954}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 216c4c1a935737b46881baf3616eb67e, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.2, y: 0.2}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
--- !u!232 &232019487599184054
DistanceJoint2D:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1227970671616358}
m_Enabled: 1
serializedVersion: 4
m_EnableCollision: 0
m_ConnectedRigidBody: {fileID: 50653538350569260}
m_BreakForce: Infinity
m_BreakTorque: Infinity
m_AutoConfigureConnectedAnchor: 0
m_Anchor: {x: 0, y: 0}
m_ConnectedAnchor: {x: 0, y: 0}
m_AutoConfigureDistance: 1
m_Distance: 6.676301
m_MaxDistanceOnly: 0
--- !u!232 &232860595527747538
DistanceJoint2D:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1954875215666954}
m_Enabled: 1
serializedVersion: 4
m_EnableCollision: 0
m_ConnectedRigidBody: {fileID: 50199550569727980}
m_BreakForce: Infinity
m_BreakTorque: Infinity
m_AutoConfigureConnectedAnchor: 0
m_Anchor: {x: 0, y: 0}
m_ConnectedAnchor: {x: 0, y: 0}
m_AutoConfigureDistance: 1
m_Distance: 6.676301
m_MaxDistanceOnly: 0
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InputManagerScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerBehavior : MonoBehaviour {
[SerializeField]
private float Acceleration;
/* Movement to apply this frame */
private Vector3 Movement;
public GameObject player;
private Rigidbody2D playerBody;
public void MoveLeft()
{
Movement.x -= Acceleration;
}
public void MoveRight()
{
Movement.x += Acceleration;
}
public void MoveUp()
{
Movement.y += Acceleration;
}
public void MoveDown()
{
Movement.y -= Acceleration;
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
playerBody.AddForce(Vector3.ClampMagnitude(Movement, Acceleration));
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerTetherScript : MonoBehaviour {
/* How far the players can go before the tether pulls them in */
[SerializeField]
private float MaxDistance;
/* Hooke's law labels this k, how much force the tether applies */
[SerializeField]
private float elasticity;
/* The current distance between the two players */
[SerializeField]
private float curDistance;
/* Our Players */
[SerializeField]
private GameObject playerOne;
[SerializeField]
private GameObject playerTwo;
private Rigidbody2D playerOneBody;
private Rigidbody2D playerTwoBody;
/* My Components */
LineRenderer tetherVisual;
public void DrawTether()
{
if(curDistance > MaxDistance)
{
tetherVisual.SetColors(Color.red, Color.blue);
}
tetherVisual.SetPosition(0, playerOne.transform.position);
tetherVisual.SetPosition(1, playerTwo.transform.position);
}
// Use this for initialization
void Start () {
playerOneBody = playerOne.GetComponent<Rigidbody2D>();
playerTwoBody = playerTwo.GetComponent<Rigidbody2D>();
tetherVisual = this.GetComponent<LineRenderer>();
}
// Update is called once per frame
void Update () {
// Get current distance
Vector3 posOne = playerOne.transform.position;
Vector3 posTwo = playerTwo.transform.position;
// Distance vector of p1 to p2
Vector3 difference = posOne - posTwo;
// Magnitide of difference
curDistance = Vector3.Distance(posOne, posTwo);
if (curDistance > MaxDistance)
{
float tension = (elasticity * curDistance) / 2;
difference = Vector3.ClampMagnitude(difference, tension);
playerOneBody.AddForce(-difference);
playerTwoBody.AddForce(difference);
}
DrawTether();
}
}
CMPT306_Fall2017/Assets/Sprites/Circle2.png

11.6 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment