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.

63 lines
1.3 KiB

  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4. public class menuContrller : MonoBehaviour {
  5. public GameObject menu;
  6. public GameObject options;
  7. public GameObject levelSelect;
  8. public GameObject btn_2player;
  9. public GameObject btn_3player;
  10. public GameObject btn_4player;
  11. public levelController control;
  12. // Use this for initialization
  13. void Start () {
  14. }
  15. // Update is called once per frame
  16. void Update () {
  17. }
  18. public void panelSelect (string panel){
  19. menu.SetActive (false);
  20. options.SetActive (false);
  21. levelSelect.SetActive (false);
  22. if (panel == "menu")
  23. menu.SetActive (true);
  24. if (panel =="options")
  25. options.SetActive (true);
  26. if (panel == "levelSelect")
  27. levelSelect.SetActive (true);
  28. }
  29. public void playerSelect (int players){
  30. btn_2player.GetComponent<Image> ().color = Color.grey;
  31. btn_3player.GetComponent<Image> ().color = Color.grey;
  32. btn_4player.GetComponent<Image> ().color = Color.grey;
  33. control.playerCount = players;
  34. if (players == 2)
  35. btn_2player.GetComponent<Image> ().color = Color.red;
  36. if (players == 3)
  37. btn_3player.GetComponent<Image> ().color = Color.red;
  38. if (players == 4)
  39. btn_4player.GetComponent<Image> ().color = Color.red;
  40. }
  41. public void levelStart (string level){
  42. Application.LoadLevel (level);
  43. }
  44. }