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.

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