Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Prelevelbetatrigger : boolean = false;
- var playerStatus : ThirdPersonStatus;
- var Cube : GameObject;
- //var Architect1: AudioClip;
- var PrelevelwindowRect : Rect = Rect(20, 20, 120, 50);
- var encumblinktotriggercube1 : InventoryManager;
- var yesbutton : boolean = false;
- var nobutton : boolean = false;
- function Start ()
- {
- encumblinktotriggercube1 = GameObject.Find("/Inventory").GetComponent(InventoryManager);
- if(!encumblinktotriggercube1)
- {
- Debug.Log("EnemyPoliceGuy: No link to Encumbrance!");
- }
- }
- function OnTriggerEnter (col: Collider) {
- if (gameObject == Cube && encumblinktotriggercube1.currentEncumbrance > 2){
- if(col.gameObject.CompareTag("Player"))
- {
- Prelevelbetatrigger = true;
- print(Prelevelbetatrigger);
- //AudioSource.PlayClipAtPoint(Architect1, Camera.main.transform.position);
- yield WaitForSeconds(10.0);
- Prelevelbetatrigger = false;
- print(Prelevelbetatrigger);
- }
- //yield WaitForSeconds (10.0);
- //Application.LoadLevel("Level 2");
- }
- }
- function OnGUI()
- {
- if(Prelevelbetatrigger && yesbutton)
- {
- GUI.BeginGroup (Rect (Screen.width / 2 - 50, Screen.height / 2 - 50, 100, 100));
- GUI.Box (Rect(0, 0, 100, 100), "Enter \n treasure \n chest");
- Destroy(this, 3.5f);
- GUI.EndGroup ();
- }
- if(Prelevelbetatrigger && nobutton)
- {
- GUI.BeginGroup (Rect (Screen.width / 2 - 50, Screen.height / 2 - 50, 100, 100));
- GUI.Box (Rect(0, 0, 100, 100), "You \n cannot \n enter");
- Destroy(this, 3.5f);
- GUI.EndGroup ();
- }
- if (Prelevelbetatrigger)
- {
- GUI.BeginGroup (Rect (Screen.width / 2 - 50, Screen.height / 2 - 50, 100, 100));
- GUI.Box (Rect(0, 0, 100, 100), "Give inventory?");
- Destroy(this, 3.5f);
- if (GUI.Button (Rect(25, 25, 50, 30), "Yes"))
- {
- yesbutton = true;
- if (yesbutton)
- {
- GUI.Box (Rect(0, 0, 100, 100), "Enter \n treasure \n chest");
- Destroy(this, 5.0f);
- }
- }
- if (GUI.Button (Rect(25, 65, 50, 30), "No"))
- {
- nobutton = true;
- if (nobutton)
- {
- GUI.Box (Rect(0, 0, 100, 100), "You \n cannot \n enter");
- Destroy(this, 5.0f);
- }
- }
- GUI.EndGroup ();
- }
- //yesbutton =false;
- //nobutton=false;
- }
Add Comment
Please, Sign In to add comment