using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
|
|
public class menuContrller : MonoBehaviour {
|
|
|
|
public GameObject menu;
|
|
public GameObject options;
|
|
public GameObject levelSelect;
|
|
public GameObject btn_2player;
|
|
public GameObject btn_3player;
|
|
public GameObject btn_4player;
|
|
public GameObject txt_score;
|
|
public GameObject txt_confetti;
|
|
public levelController control;
|
|
public GameObject alpaca;
|
|
public GameObject platypuss;
|
|
public GameObject goat;
|
|
public GameObject kangaroo;
|
|
|
|
// Use this for initialization
|
|
void Start () {
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
}
|
|
|
|
public void panelSelect (string panel){
|
|
menu.SetActive (false);
|
|
options.SetActive (false);
|
|
levelSelect.SetActive (false);
|
|
alpaca.SetActive (true);
|
|
goat.SetActive (true);
|
|
platypuss.SetActive (true);
|
|
kangaroo.SetActive (true);
|
|
|
|
if (panel == "menu")
|
|
menu.SetActive (true);
|
|
if (panel =="options")
|
|
options.SetActive (true);
|
|
if (panel == "levelSelect") {
|
|
levelSelect.SetActive (true);
|
|
alpaca.SetActive (false);
|
|
goat.SetActive (false);
|
|
platypuss.SetActive (false);
|
|
kangaroo.SetActive (false);
|
|
|
|
}
|
|
}
|
|
|
|
public void playerSelect (int players){
|
|
btn_2player.GetComponent<Image> ().color = Color.grey;
|
|
btn_3player.GetComponent<Image> ().color = Color.grey;
|
|
btn_4player.GetComponent<Image> ().color = Color.grey;
|
|
|
|
control.playerCount = players;
|
|
|
|
if (players == 2)
|
|
btn_2player.GetComponent<Image> ().color = Color.red;
|
|
if (players == 3)
|
|
btn_3player.GetComponent<Image> ().color = Color.red;
|
|
if (players == 4)
|
|
btn_4player.GetComponent<Image> ().color = Color.red;
|
|
|
|
|
|
}
|
|
|
|
public void levelStart (string level){
|
|
|
|
Application.LoadLevel (level);
|
|
|
|
}
|
|
|
|
public void scoreChange (float score){
|
|
|
|
txt_score.GetComponent<Text> ().text = "" + Mathf.RoundToInt(score);
|
|
control.maxScore = Mathf.RoundToInt (score);
|
|
|
|
}
|
|
|
|
public void confettiSlider (float confetti){
|
|
txt_confetti.GetComponent<Text> ().text = "" + Mathf.RoundToInt(confetti);
|
|
control.confetti = Mathf.RoundToInt (confetti);
|
|
}
|
|
|
|
}
|