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;
|
|
|
|
// 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);
|
|
|
|
if (panel == "menu")
|
|
menu.SetActive (true);
|
|
if (panel =="options")
|
|
options.SetActive (true);
|
|
if (panel == "levelSelect")
|
|
levelSelect.SetActive (true);
|
|
|
|
|
|
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
}
|