Added start countdown
Small UI changes Fixed initialization order for the GameManager
This commit is contained in:
@@ -36,7 +36,7 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
private AudioSource audioSource;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
void Awake()
|
||||
{
|
||||
this.players = GameObject.FindGameObjectsWithTag("Player");
|
||||
this.initialPositions = new Vector3[this.players.Length];
|
||||
@@ -71,14 +71,14 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
if (this.scorePlayer1 >= maxGoals)
|
||||
{
|
||||
winLabel.text = "Player 1 wins the game!";
|
||||
winLabel.text = "Player 1 won!";
|
||||
winLabel.transform.gameObject.SetActive(true);
|
||||
Time.timeScale = 0.0f;
|
||||
}
|
||||
|
||||
if (this.scorePlayer2 >= maxGoals)
|
||||
{
|
||||
winLabel.text = "Player 2 wins the game!";
|
||||
winLabel.text = "Player 2 won!";
|
||||
winLabel.transform.gameObject.SetActive(true);
|
||||
Time.timeScale = 0.0f;
|
||||
}
|
||||
@@ -110,4 +110,12 @@ public class GameManager : MonoBehaviour
|
||||
this.ball.GetComponent<Rigidbody>().velocity = Vector3.zero;
|
||||
|
||||
}
|
||||
|
||||
public void LockControls(float duration)
|
||||
{
|
||||
for (int i = 0; i < this.players.Length; i++)
|
||||
{
|
||||
this.players[i].GetComponent<PlayerController>().InputTimeout(duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user