You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
3.4 KiB

  1. using UnityEngine;
  2. using System.Collections;
  3. public class Menu : MonoBehaviour {
  4. public GameObject player1;
  5. public GameObject player2;
  6. public GameObject player3;
  7. public GameObject player4;
  8. public GameObject musicTrad;
  9. public GameObject musicEpic;
  10. private bool start = false;
  11. private bool menu = true;
  12. private float goreCount = 20;
  13. private string music = "Traditional";
  14. // Use this for initialization
  15. void Start () {
  16. }
  17. // Update is called once per frame
  18. void Update () {
  19. player1.GetComponent<playerController> ().confettiOnHit = (int) goreCount;
  20. player2.GetComponent<playerController> ().confettiOnHit = (int) goreCount;
  21. player3.GetComponent<playerController> ().confettiOnHit = (int) goreCount;
  22. player4.GetComponent<playerController> ().confettiOnHit = (int) goreCount;
  23. if (Input.GetKeyDown ("escape")) {
  24. if (menu)
  25. start = false;
  26. else
  27. start = !start;
  28. menu = false;
  29. }
  30. }
  31. void OnGUI ()
  32. {
  33. if (start) {
  34. // Make a background box
  35. GUI.Box (new Rect (Screen.width / 2 - 100, Screen.height / 2 - 150, 200, 300), "Menu");
  36. // Make the first button.
  37. if (GUI.Button (new Rect (Screen.width / 2 - 90, Screen.height / 2 - 130, 180, 80), "Options")) {
  38. start = false;
  39. menu = true;
  40. }
  41. // Make the second button.
  42. if (GUI.Button (new Rect (Screen.width / 2 - 90, Screen.height / 2 - 40, 180, 80), "Reset Level")) {
  43. Application.LoadLevel ("Lachlan_jump_work");
  44. start = false;
  45. }
  46. // Make the second button.
  47. if (GUI.Button (new Rect (Screen.width / 2 - 90, Screen.height / 2 + 50, 180, 80), "Exit")) {
  48. Application.Quit ();
  49. }
  50. }
  51. if (menu) {
  52. GUI.Box (new Rect (Screen.width / 2 - 100, Screen.height / 2 - 150, 200, 300), "Options");
  53. if (GUI.Button (new Rect (Screen.width / 2 - 95, Screen.height / 2 - 120, 90, 30), "1 Player")) {
  54. player1.SetActive(true);
  55. player2.SetActive(false);
  56. player3.SetActive(false);
  57. player4.SetActive(false);
  58. }
  59. if (GUI.Button (new Rect (Screen.width / 2+ 5 , Screen.height / 2 - 120, 90, 30), "2 Players")) {
  60. player1.SetActive(true);
  61. player2.SetActive(true);
  62. player3.SetActive(false);
  63. player4.SetActive(false);
  64. }
  65. if (GUI.Button (new Rect (Screen.width / 2 - 95, Screen.height / 2 - 85, 90, 30), "3 Players")) {
  66. player1.SetActive(true);
  67. player2.SetActive(true);
  68. player3.SetActive(true);
  69. player4.SetActive(false);
  70. }
  71. if (GUI.Button (new Rect (Screen.width / 2+ 5 , Screen.height / 2 - 85, 90, 30), "4 Players")) {
  72. player1.SetActive(true);
  73. player2.SetActive(true);
  74. player3.SetActive(true);
  75. player4.SetActive(true);
  76. }
  77. goreCount= (int) GUI.HorizontalSlider(new Rect(Screen.width/2 -90, Screen.height/2 - 10, 180, 20), goreCount, 0.0F, 200);
  78. GUI.Label(new Rect(Screen.width/2 - 11, Screen.height/2 +5, 200, 70), "" +goreCount);
  79. GUI.Label(new Rect(Screen.width/2 - 30, Screen.height/2 -30, 200, 70), "Confetti Count");
  80. if (GUI.Button (new Rect (Screen.width / 2-90 , Screen.height / 2 +50, 90, 30), "Music")) {
  81. if (music =="Epic"){
  82. music = "Traditional";
  83. musicEpic.SetActive(false);
  84. musicTrad.SetActive(true);
  85. }
  86. else if (music =="Traditional"){
  87. music = "Epic";
  88. musicEpic.SetActive(true);
  89. musicTrad.SetActive(false);
  90. }
  91. }
  92. GUI.Label(new Rect(Screen.width/2 +5, Screen.height/2 +55, 90, 30), "" +music);
  93. if (GUI.Button (new Rect (Screen.width / 2-90 , Screen.height / 2 +90, 180, 30), "Exit Menu")) {
  94. menu = false;
  95. }
  96. }
  97. }
  98. }