diff --git a/Game 1/Assets/Scripts/CameraController.cs b/Game 1/Assets/Scripts/CameraController.cs new file mode 100644 index 0000000..233a372 --- /dev/null +++ b/Game 1/Assets/Scripts/CameraController.cs @@ -0,0 +1,30 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CameraController : MonoBehaviour { + + public GameObject player; + + private Vector3 offset; + private Vector3 newPosition; + + private float minX, maxX, minY, maxY; + + void Start () { + offset = transform.position - player.transform.position; + + minX = 0.0f; + maxX = 0.0f; + minY = 0.0f; + maxY = 18.0f; + } + + void LateUpdate () { + newPosition = player.transform.position + offset; + + if(newPosition.x >= minX && newPosition.x <= maxX && newPosition.y >= minY && newPosition.y <= maxY) + transform.position = newPosition; + + } +} diff --git a/Game 1/Assets/Scripts/CameraController.cs.meta b/Game 1/Assets/Scripts/CameraController.cs.meta new file mode 100644 index 0000000..32ab67f --- /dev/null +++ b/Game 1/Assets/Scripts/CameraController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 82066df26cc71bd46bc0762b0aba7372 +timeCreated: 1504643500 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Game 1/Assets/Scripts/PlayerController.cs b/Game 1/Assets/Scripts/PlayerController.cs index 13548e3..b26c2d8 100644 --- a/Game 1/Assets/Scripts/PlayerController.cs +++ b/Game 1/Assets/Scripts/PlayerController.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.UI; // Simple script for a test I need to do @@ -9,9 +10,11 @@ public class PlayerController : MonoBehaviour { public float jumpPower; public GameObject rocketPrefab; + public Text winText; + // Use this for initialization void Start () { - + } // Update is called once per frame @@ -29,4 +32,12 @@ public class PlayerController : MonoBehaviour { rocket.GetComponent().player = this; } } + + void OnTriggerEnter2D(Collider2D other) + { + //Check the provided Collider2D parameter other to see if it is tagged "PickUp", if it is... + if (other.gameObject.CompareTag ("Finish Line")) { + winText.text = "You Win!"; + } + } } diff --git a/Game 1/ProjectSettings/ProjectVersion.txt b/Game 1/ProjectSettings/ProjectVersion.txt index a211ccd..ca1aa05 100644 --- a/Game 1/ProjectSettings/ProjectVersion.txt +++ b/Game 1/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2017.1.1f1 +m_EditorVersion: 2017.1.0f3 diff --git a/Game 1/ProjectSettings/TagManager.asset b/Game 1/ProjectSettings/TagManager.asset index 4459eeb..0f4d140 100644 --- a/Game 1/ProjectSettings/TagManager.asset +++ b/Game 1/ProjectSettings/TagManager.asset @@ -3,7 +3,8 @@ --- !u!78 &1 TagManager: serializedVersion: 2 - tags: [] + tags: + - Finish Line layers: - Default - TransparentFX