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.

106 lines
2.3 KiB

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine.UI;
  4. using UnityEngine;
  5. public class MainMenuController : MonoBehaviour
  6. {
  7. public GameObject GameOptionsMenu;
  8. public GameObject SettingsMenu;
  9. public GameObject MainMenu;
  10. public GameObject HowToPlayMenu;
  11. public Button SoundButton;
  12. public Button MusicButton;
  13. bool soundVolume = true;
  14. bool musicVolume = true;
  15. //On Awake
  16. private void Awake ()
  17. {
  18. MainMenu.SetActive (true);
  19. SettingsMenu.SetActive (false);
  20. GameOptionsMenu.SetActive (false);
  21. HowToPlayMenu.SetActive (false);
  22. }
  23. //Main Menu Options
  24. public void OnPlayClick ()
  25. {
  26. //toggle which menu displays
  27. MainMenu.SetActive (false);
  28. GameOptionsMenu.SetActive (true);
  29. }
  30. public void OnSettingsClick ()
  31. {
  32. //toggle which menu displays
  33. MainMenu.SetActive (false);
  34. SettingsMenu.SetActive (true);
  35. }
  36. public void OnTutorialClick ()
  37. {
  38. MainMenu.SetActive (false);
  39. HowToPlayMenu.SetActive (true);
  40. }
  41. public void OnTutorialContinueClick ()
  42. {
  43. UnityEngine.SceneManagement.SceneManager.LoadScene ("TuteLevelOne");
  44. }
  45. //Game Options and Settings Menu
  46. public void OnBackClick ()
  47. {
  48. GameOptionsMenu.SetActive (false);
  49. SettingsMenu.SetActive (false);
  50. MainMenu.SetActive (true);
  51. }
  52. //Game Options Menu
  53. public void OnRecompileRaceClick ()
  54. {
  55. UnityEngine.SceneManagement.SceneManager.LoadScene ("ReCompileRaceOne");
  56. }
  57. public void OnColourCollideClick ()
  58. {
  59. UnityEngine.SceneManagement.SceneManager.LoadScene ("ColourCollideOne");
  60. }
  61. public void OnChickenRunClick ()
  62. {
  63. UnityEngine.SceneManagement.SceneManager.LoadScene ("ChickenRunOne");
  64. }
  65. //Settings menu
  66. public void OnSoundVolumeClick ()
  67. {
  68. if (soundVolume == true) {
  69. SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: OFF";
  70. soundVolume = false;
  71. } else {
  72. SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: ON";
  73. soundVolume = true;
  74. }
  75. }
  76. public void OnMusicVolumeClick ()
  77. {
  78. if (musicVolume == true) {
  79. //backgroundMusic.Stop();
  80. MusicButton.GetComponentInChildren<Text> ().text = "Music Volume: OFF";
  81. musicVolume = false;
  82. } else {
  83. //backgroundMusic.Play();
  84. MusicButton.GetComponentInChildren<Text> ().text = "Music Volume: ON";
  85. musicVolume = true;
  86. }
  87. }
  88. public void OnUnknownClick ()
  89. {
  90. }
  91. }