|
@ -1,5 +1,6 @@ |
|
|
using UnityEngine; |
|
|
using UnityEngine; |
|
|
using System.Collections; |
|
|
using System.Collections; |
|
|
|
|
|
using UnityEngine.UI; |
|
|
|
|
|
|
|
|
public class sceneController : MonoBehaviour { |
|
|
public class sceneController : MonoBehaviour { |
|
|
|
|
|
|
|
@ -9,11 +10,23 @@ public class sceneController : MonoBehaviour { |
|
|
public GameObject player4; |
|
|
public GameObject player4; |
|
|
public levelController control; |
|
|
public levelController control; |
|
|
private int playerCount; |
|
|
private int playerCount; |
|
|
|
|
|
public GameObject options; |
|
|
|
|
|
public bool paused = false; |
|
|
|
|
|
public GameObject confettiText; |
|
|
|
|
|
public GameObject scoreText; |
|
|
|
|
|
|
|
|
|
|
|
public playerId id1; |
|
|
|
|
|
public playerId id2; |
|
|
|
|
|
public playerId id3; |
|
|
|
|
|
public playerId id4; |
|
|
|
|
|
|
|
|
private playerController playerScript1; |
|
|
private playerController playerScript1; |
|
|
private playerController playerScript2; |
|
|
private playerController playerScript2; |
|
|
private playerController playerScript3; |
|
|
private playerController playerScript3; |
|
|
private playerController playerScript4; |
|
|
private playerController playerScript4; |
|
|
|
|
|
|
|
|
|
|
|
private bool exit = false; |
|
|
|
|
|
|
|
|
// Use this for initialization
|
|
|
// Use this for initialization
|
|
|
|
|
|
|
|
|
void Awake(){ |
|
|
void Awake(){ |
|
@ -59,6 +72,84 @@ public class sceneController : MonoBehaviour { |
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
// Update is called once per frame
|
|
|
void Update () { |
|
|
void Update () { |
|
|
|
|
|
|
|
|
|
|
|
if (Input.GetButtonDown("start")) { |
|
|
|
|
|
paused = !paused; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
optionsSelect (); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void optionsSelect(){ |
|
|
|
|
|
|
|
|
|
|
|
if (paused) { |
|
|
|
|
|
Time.timeScale = 0.0f; |
|
|
|
|
|
options.SetActive (true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (!paused) { |
|
|
|
|
|
Time.timeScale = 1.0f; |
|
|
|
|
|
options.SetActive (false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (exit) { |
|
|
|
|
|
Time.timeScale = 1.0f; |
|
|
|
|
|
Application.LoadLevel("Menu_Scene"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void confetti(float confettiAmount){ |
|
|
|
|
|
control.confetti = Mathf.RoundToInt(confettiAmount); |
|
|
|
|
|
confettiText.GetComponent<Text> ().text = "" + Mathf.RoundToInt(confettiAmount); |
|
|
|
|
|
playerScript1.confettiOnHit = control.confetti; |
|
|
|
|
|
playerScript2.confettiOnHit = control.confetti; |
|
|
|
|
|
playerScript3.confettiOnHit = control.confetti; |
|
|
|
|
|
playerScript4.confettiOnHit = control.confetti; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void sccore (float scoreMax){ |
|
|
|
|
|
control.maxScore = Mathf.RoundToInt(scoreMax); |
|
|
|
|
|
scoreText.GetComponent<Text> ().text = "" + Mathf.RoundToInt(scoreMax); |
|
|
|
|
|
playerScript1.maxScore = control.maxScore; |
|
|
|
|
|
playerScript2.maxScore = control.maxScore; |
|
|
|
|
|
playerScript3.maxScore = control.maxScore; |
|
|
|
|
|
playerScript4.maxScore = control.maxScore; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void mute (bool muted){ |
|
|
|
|
|
if (muted) |
|
|
|
|
|
AudioListener.volume = 0.0f; |
|
|
|
|
|
else |
|
|
|
|
|
AudioListener.volume = 1.0f; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void dispID (bool visible){ |
|
|
|
|
|
id1.idVanishDisp = visible; |
|
|
|
|
|
id2.idVanishDisp = visible; |
|
|
|
|
|
id3.idVanishDisp = visible; |
|
|
|
|
|
id4.idVanishDisp = visible; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void exitLevel (){ |
|
|
|
|
|
Time.timeScale = 1.0f; |
|
|
|
|
|
exit = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void resumeGame(){ |
|
|
|
|
|
paused = false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |