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.

76 lines
1.7 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 GameObject txt_score;
  12. public GameObject txt_confetti;
  13. public levelController control;
  14. // Use this for initialization
  15. void Start () {
  16. }
  17. // Update is called once per frame
  18. void Update () {
  19. }
  20. public void panelSelect (string panel){
  21. menu.SetActive (false);
  22. options.SetActive (false);
  23. levelSelect.SetActive (false);
  24. if (panel == "menu")
  25. menu.SetActive (true);
  26. if (panel =="options")
  27. options.SetActive (true);
  28. if (panel == "levelSelect")
  29. levelSelect.SetActive (true);
  30. }
  31. public void playerSelect (int players){
  32. btn_2player.GetComponent<Image> ().color = Color.grey;
  33. btn_3player.GetComponent<Image> ().color = Color.grey;
  34. btn_4player.GetComponent<Image> ().color = Color.grey;
  35. control.playerCount = players;
  36. if (players == 2)
  37. btn_2player.GetComponent<Image> ().color = Color.red;
  38. if (players == 3)
  39. btn_3player.GetComponent<Image> ().color = Color.red;
  40. if (players == 4)
  41. btn_4player.GetComponent<Image> ().color = Color.red;
  42. }
  43. public void levelStart (string level){
  44. Application.LoadLevel (level);
  45. }
  46. public void scoreChange (float score){
  47. txt_score.GetComponent<Text> ().text = "" + Mathf.RoundToInt(score);
  48. control.maxScore = Mathf.RoundToInt (score);
  49. }
  50. public void confettiSlider (float confetti){
  51. txt_confetti.GetComponent<Text> ().text = "" + Mathf.RoundToInt(confetti);
  52. control.confetti = Mathf.RoundToInt (confetti);
  53. }
  54. }