diff --git a/Assets/Prefabs/Character.prefab b/Assets/Prefabs/Character.prefab index 64c6cce..7d640e4 100644 Binary files a/Assets/Prefabs/Character.prefab and b/Assets/Prefabs/Character.prefab differ diff --git a/Assets/Prefabs/Main Camera.prefab b/Assets/Prefabs/Main Camera.prefab new file mode 100644 index 0000000..11d0cac Binary files /dev/null and b/Assets/Prefabs/Main Camera.prefab differ diff --git a/Assets/Prefabs/Main Camera.prefab.meta b/Assets/Prefabs/Main Camera.prefab.meta new file mode 100644 index 0000000..b7d6c96 --- /dev/null +++ b/Assets/Prefabs/Main Camera.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c6315d57d22df49cabe86636b97689d3 +timeCreated: 1466872062 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index ddaa2e4..227a285 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -5,7 +5,6 @@ public class PlayerMovement : MonoBehaviour { public float speed = 0f; public float turn = 0f; - public GameObject camera; public Rigidbody characterRigidBody; //private Rigidbody rb; @@ -13,7 +12,7 @@ public class PlayerMovement : MonoBehaviour { // Update is called once per frame void Update () { - Vector3 fowardVector = new Vector3(camera.transform.forward.x, 0, camera.transform.forward.z); + Vector3 fowardVector = new Vector3(Camera.main.transform.forward.x, 0, Camera.main.transform.forward.z); if (Input.GetAxis("Vertical")>0) { diff --git a/Assets/Scripts/SlowdownScript.cs b/Assets/Scripts/SlowdownScript.cs new file mode 100644 index 0000000..906ed2a --- /dev/null +++ b/Assets/Scripts/SlowdownScript.cs @@ -0,0 +1,38 @@ +using UnityEngine; +using System.Collections; + +public class SlowdownScript : MonoBehaviour { + + private float duration = 5.0f; + private bool pickedUp = false; + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update() + { + if(pickedUp) + { + Time.timeScale = 0.5f; + StartCoroutine(Wait(duration)); + Time.timeScale = 1.0f; + } + } + + void OnTriggerEnter(Collider col) + { + if (col.gameObject.CompareTag("Player")) + { + pickedUp = true; + gameObject.SetActive(false); + } + } + + IEnumerator Wait(float seconds) + { + yield return new WaitForSeconds(seconds); + } +} diff --git a/Assets/Scripts/SlowdownScript.cs.meta b/Assets/Scripts/SlowdownScript.cs.meta new file mode 100644 index 0000000..9d27c8e --- /dev/null +++ b/Assets/Scripts/SlowdownScript.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c5d317885d9034ae492a544e9dd04107 +timeCreated: 1466884297 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SphereMover.cs b/Assets/Scripts/SphereMover.cs new file mode 100644 index 0000000..1ca2d56 --- /dev/null +++ b/Assets/Scripts/SphereMover.cs @@ -0,0 +1,30 @@ +using UnityEngine; +using System.Collections; + +public class SphereMover : MonoBehaviour { + + public float speed = 2.0f; + private bool bascule = false; + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void FixedUpdate() + { + if (bascule) + transform.Translate (Vector2.right * speed * Time.deltaTime); + else + transform.Translate (-Vector2.right * speed * Time.deltaTime); + + if(transform.position.x >= 4.0f) { + bascule = false; + } + + if(transform.position.x <= -4) { + bascule = true; + } + } +} diff --git a/Assets/Scripts/SphereMover.cs.meta b/Assets/Scripts/SphereMover.cs.meta new file mode 100644 index 0000000..ce003ba --- /dev/null +++ b/Assets/Scripts/SphereMover.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b82403f7e7f384b7e99b0c400ba33edd +timeCreated: 1466879067 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/TileController.cs b/Assets/Scripts/TileController.cs index 879a7d3..fdbc32a 100644 --- a/Assets/Scripts/TileController.cs +++ b/Assets/Scripts/TileController.cs @@ -55,4 +55,12 @@ public class TileController : MonoBehaviour } } + + void OnTriggerEnter (Collider other) + { + if (other.tag == "DestroyTrigger") + { + Destroy(this.gameObject); + } + } } diff --git a/Assets/Scripts/ViewControl.cs b/Assets/Scripts/ViewControl.cs index 2bd47f6..c53f884 100644 --- a/Assets/Scripts/ViewControl.cs +++ b/Assets/Scripts/ViewControl.cs @@ -5,7 +5,6 @@ public class ViewControl : MonoBehaviour { // Speed at which the camera will catch up to the mouse pointer location - public float smoothing = 1.5f; public float mouseSensitivity = 100.0f; public float clampAngle = 80.0f;