Global Game Jam 2021
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.

50 lines
847 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using NaughtyAttributes;
  5. public class MainMenuUI : MonoBehaviour
  6. {
  7. [SerializeField,Scene]
  8. private string m_JoinScene;
  9. [SerializeField]
  10. private GameObject[] m_Panels;
  11. private void OnEnable()
  12. {
  13. OnClickChangePanel(m_Panels[0]);
  14. }
  15. public void OnClickPlay()
  16. {
  17. UnityEngine.SceneManagement.SceneManager.LoadScene(m_JoinScene);
  18. }
  19. public void OnClickQuit()
  20. {
  21. #if UNITY_EDITOR
  22. UnityEditor.EditorApplication.isPlaying = false;
  23. #else
  24. Application.Quit();
  25. #endif
  26. }
  27. public void OnClickChangePanel(GameObject newPanel)
  28. {
  29. foreach (var panel in m_Panels)
  30. panel.SetActive(false);
  31. if (newPanel != null)
  32. newPanel.SetActive(true);
  33. }
  34. }