using UnityEngine; using System.Collections; public class Menu : MonoBehaviour { public GameObject player1; public GameObject player2; public GameObject player3; public GameObject player4; public GameObject musicTrad; public GameObject musicEpic; private bool start = false; private bool menu = true; private float goreCount = 20; private string music = "Traditional"; // Use this for initialization void Start () { } // Update is called once per frame void Update () { player1.GetComponent ().confettiOnHit = (int) goreCount; player2.GetComponent ().confettiOnHit = (int) goreCount; player3.GetComponent ().confettiOnHit = (int) goreCount; player4.GetComponent ().confettiOnHit = (int) goreCount; if (Input.GetKeyDown ("escape")) { if (menu) start = false; else start = !start; menu = false; } if (start || menu) Time.timeScale = 0; else Time.timeScale = 1; } void OnGUI () { if (start) { // Make a background box GUI.Box (new Rect (Screen.width / 2 - 100, Screen.height / 2 - 150, 200, 300), "Menu"); // Make the first button. if (GUI.Button (new Rect (Screen.width / 2 - 90, Screen.height / 2 - 130, 180, 80), "Options")) { start = false; menu = true; } // Make the second button. if (GUI.Button (new Rect (Screen.width / 2 - 90, Screen.height / 2 - 40, 180, 80), "Reset Level")) { Application.LoadLevel ("Lachlan_jump_work"); start = false; } // Make the second button. if (GUI.Button (new Rect (Screen.width / 2 - 90, Screen.height / 2 + 50, 180, 80), "Exit")) { Application.Quit (); } } if (menu) { GUI.Box (new Rect (Screen.width / 2 - 100, Screen.height / 2 - 150, 200, 300), "Options"); if (GUI.Button (new Rect (Screen.width / 2 - 95, Screen.height / 2 - 120, 90, 30), "1 Player")) { player1.SetActive(true); player2.SetActive(false); player3.SetActive(false); player4.SetActive(false); } if (GUI.Button (new Rect (Screen.width / 2+ 5 , Screen.height / 2 - 120, 90, 30), "2 Players")) { player1.SetActive(true); player2.SetActive(true); player3.SetActive(false); player4.SetActive(false); } if (GUI.Button (new Rect (Screen.width / 2 - 95, Screen.height / 2 - 85, 90, 30), "3 Players")) { player1.SetActive(true); player2.SetActive(true); player3.SetActive(true); player4.SetActive(false); } if (GUI.Button (new Rect (Screen.width / 2+ 5 , Screen.height / 2 - 85, 90, 30), "4 Players")) { player1.SetActive(true); player2.SetActive(true); player3.SetActive(true); player4.SetActive(true); } goreCount= (int) GUI.HorizontalSlider(new Rect(Screen.width/2 -90, Screen.height/2 - 10, 180, 20), goreCount, 0.0F, 200); GUI.Label(new Rect(Screen.width/2 - 11, Screen.height/2 +5, 200, 70), "" +goreCount); GUI.Label(new Rect(Screen.width/2 - 30, Screen.height/2 -30, 200, 70), "Confetti Count"); if (GUI.Button (new Rect (Screen.width / 2-90 , Screen.height / 2 +50, 90, 30), "Music")) { if (music =="Epic"){ music = "Traditional"; musicEpic.SetActive(false); musicTrad.SetActive(true); } else if (music =="Traditional"){ music = "Epic"; musicEpic.SetActive(true); musicTrad.SetActive(false); } } GUI.Label(new Rect(Screen.width/2 +5, Screen.height/2 +55, 90, 30), "" +music); if (GUI.Button (new Rect (Screen.width / 2-90 , Screen.height / 2 +90, 180, 30), "Exit Menu")) { menu = false; } } } }