Commit 71c3dd18 authored by Ashley's avatar Ashley

when birb dies, the level restarts

parent 19fc040f
......@@ -2,11 +2,12 @@
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameManager : SingletonBehaviour<GameManager>
{
//Manages game state. Pause, death, win, changing levels, and level time.
public float waitTime;
private bool _isPaused;
private float _levelTimer;
public Text timerText;
......@@ -51,6 +52,11 @@ public class GameManager : SingletonBehaviour<GameManager>
public static void Fail()
{
Debug.Log("You have died");
GameManager.instance.Invoke("ReloadScene", GameManager.instance.waitTime);
}
void ReloadScene()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
public static void Win()
{
......
......@@ -46,6 +46,7 @@ public class Birb : AbstractBehavior {
animator.SetBool("is dead", true);
body.isKinematic = true;
body.velocity = Vector2.zero;
new WaitForSeconds(5);
GameManager.Fail ();
}
......
......@@ -11,7 +11,7 @@ public class WinTrigger : MonoBehaviour {
{
//tell manager it has won
GameManager.Win();
//Debug.Log("Victory A;chieved");
//Debug.Log("Victory Achieved");
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment