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.

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