diff --git a/unity_Project/Assets/GUI Assets/Icon - PULL.controller b/unity_Project/Assets/GUI Assets/Icon - PULL.controller index ebf5c0c..d489639 100644 Binary files a/unity_Project/Assets/GUI Assets/Icon - PULL.controller and b/unity_Project/Assets/GUI Assets/Icon - PULL.controller differ diff --git a/unity_Project/Assets/GUI Assets/icon_PUSH.anim b/unity_Project/Assets/GUI Assets/icon_PUSH.anim index bef3685..2c2da7b 100644 Binary files a/unity_Project/Assets/GUI Assets/icon_PUSH.anim and b/unity_Project/Assets/GUI Assets/icon_PUSH.anim differ diff --git a/unity_Project/Assets/Scripts/impactSFX_crate.cs b/unity_Project/Assets/Scripts/impactSFX_crate.cs index 0d86b4a..4734508 100644 --- a/unity_Project/Assets/Scripts/impactSFX_crate.cs +++ b/unity_Project/Assets/Scripts/impactSFX_crate.cs @@ -12,6 +12,8 @@ public class impactSFX_crate : MonoBehaviour { private float pitchHighRange = 1.0f; // Pitch High Range private float pitchDefault = 1.0f; // Pitch Default Value + private float lastHitTime = 0.0f; + private float waitTime = 0.5f; // FUNCTION: Find Audio Source component (attached to Player Avatar Object) void Awake(){ source = GetComponent (); @@ -20,8 +22,11 @@ public class impactSFX_crate : MonoBehaviour { void PlayImpCrate(){ - source.pitch = Random.Range (pitchLowRange, pitchHighRange); - source.PlayOneShot (sfxImpCrate,0.85f); + if (Time.time > lastHitTime + waitTime) { + lastHitTime = Time.time; + source.pitch = Random.Range (pitchLowRange, pitchHighRange); + source.PlayOneShot (sfxImpCrate, 0.85f); + } } diff --git a/unity_Project/Assets/Scripts/movebetween.cs b/unity_Project/Assets/Scripts/movebetween.cs index a8faceb..7a0ef6b 100644 --- a/unity_Project/Assets/Scripts/movebetween.cs +++ b/unity_Project/Assets/Scripts/movebetween.cs @@ -3,17 +3,23 @@ using System.Collections; public class movebetween : MonoBehaviour { - public GameObject start; - public GameObject end; + public GameObject[] points; + //public GameObject end; public float distance; + public float changeDis; private Vector3 startPos; private Vector3 endPos; + public int count = 0; + public bool useCustomRotation = false; + + private Rigidbody rb; void Start(){ - startPos = start.transform.position; - endPos = end.transform.position; + rb = gameObject.GetComponent (); + startPos = points[count].transform.position; + endPos = points[count+1].transform.position; distance = Vector3.Distance (startPos, endPos) / Vector3.Distance (gameObject.transform.position, startPos); } @@ -21,12 +27,35 @@ public class movebetween : MonoBehaviour { // Update is called once per frame void Update () { - transform.position = startPos + (endPos - startPos) / distance; - + //transform.position = startPos + (endPos - startPos) / distance; + if (!useCustomRotation) { + Vector3 lookAtTarget = endPos; + lookAtTarget.y = transform.position.y; + transform.LookAt (lookAtTarget); + } } void FixedUpdate(){ + if (Vector3.Distance (gameObject.transform.position, startPos) <= changeDis && count != 0) { + count--; + startPos = points[count].transform.position; + endPos = points[count+1].transform.position; + } + if (Vector3.Distance (gameObject.transform.position, endPos) <= changeDis && count + 1 != points.Length) { + count++; + startPos = points[count].transform.position; + endPos = points[count+1].transform.position; + + } + distance = Vector3.Distance (startPos, endPos) / Vector3.Distance (gameObject.transform.position, startPos); + + Vector3 newPos = gameObject.transform.position; + newPos.x = startPos.x + (endPos.x - startPos.x) / distance; + newPos.y = startPos.y + (endPos.y - startPos.y) / distance; + + rb.MovePosition (newPos); + } } diff --git a/unity_Project/Assets/Scripts/sceneController.cs b/unity_Project/Assets/Scripts/sceneController.cs index 72675a6..0059e44 100644 --- a/unity_Project/Assets/Scripts/sceneController.cs +++ b/unity_Project/Assets/Scripts/sceneController.cs @@ -11,8 +11,8 @@ public class sceneController : MonoBehaviour { public GameObject crossHairPlayer1; public GameObject crossHairPlayer2; public GameObject playerPointer; - public Animator push; - public Animator pull; + //public Animator push; + public Animator icon; public float screenAnimationTime; @@ -87,7 +87,7 @@ public class sceneController : MonoBehaviour { oldCamera = cameraPlayer2; crossHairPlayer1.SetActive(true); crossHairPlayer2.SetActive(false); - pull.SetTrigger("appear"); + icon.SetTrigger("p1"); @@ -96,7 +96,7 @@ public class sceneController : MonoBehaviour { oldCamera = cameraPlayer1; crossHairPlayer1.SetActive(false); crossHairPlayer2.SetActive(true); - push.SetTrigger("appear"); + icon.SetTrigger("p2"); } diff --git a/unity_Project/Assets/_Scenes/MainLevel.unity b/unity_Project/Assets/_Scenes/MainLevel.unity index 68ed0b7..b74bf82 100644 Binary files a/unity_Project/Assets/_Scenes/MainLevel.unity and b/unity_Project/Assets/_Scenes/MainLevel.unity differ