Created
October 31, 2013 22:56
-
-
Save benmcnelly/7258571 to your computer and use it in GitHub Desktop.
Get the key...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // set some variables to use later | |
| var keys = 0; | |
| //Get THEKEY | |
| function OnTriggerEnter(theCollision : Collider){ | |
| if(theCollision.gameObject.name == "THEKEY"){ | |
| keys+=1; | |
| Debug.Log(keys); | |
| Debug.Log("YAY YOU GOT THE KEY"); | |
| UnityEngine.Object.Destroy(GameObject.Find("THEKEY")); | |
| } | |
| if(theCollision.gameObject.name == "THEDOOR"){ | |
| if(keys == 1){ | |
| Debug.Log("Open Door"); | |
| UnityEngine.Object.Destroy(GameObject.Find("THEACTUALDOOR")); | |
| UnityEngine.Object.Destroy(GameObject.Find("THEDOOR")); | |
| keys-=1; | |
| Debug.Log(keys); | |
| } | |
| else { | |
| Debug.Log("NEED KEY FOOL"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment