diff --git a/Assets/Scenes/CharacterTest.unity b/Assets/Scenes/CharacterTest.unity index ce634a6566c815badd32c55041c3ef9956a9d8b3..b853ce725bee927853ac135bb206ddb718f69f35 100644 Binary files a/Assets/Scenes/CharacterTest.unity and b/Assets/Scenes/CharacterTest.unity differ diff --git a/Assets/Scripts/Birb/Dash.cs b/Assets/Scripts/Birb/Dash.cs index 9aefca222a4e3582141f7d5eedb21ebc52c3814b..cf2c421ceebdc2ce4ff602787c7d2b832d4fbd6a 100644 --- a/Assets/Scripts/Birb/Dash.cs +++ b/Assets/Scripts/Birb/Dash.cs @@ -26,7 +26,7 @@ public class Dash : AbstractBehavior { } void Start() { - dashMeter = GameObject.FindGameObjectWithTag("DashMeter").transform; + //dashMeter = GameObject.FindGameObjectWithTag("DashMeter").transform; } // Should be called every frame diff --git a/Assets/Scripts/Birb/GameManager.cs b/Assets/Scripts/Birb/GameManager.cs index 530507eba4d9ef31e530324e9308ced902652c04..be006b1d53184600acab6c707786832cd9314d69 100644 --- a/Assets/Scripts/Birb/GameManager.cs +++ b/Assets/Scripts/Birb/GameManager.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using UnityEngine.UI; using UnityEngine; public class GameManager : SingletonBehaviour @@ -8,10 +9,12 @@ public class GameManager : SingletonBehaviour private bool _isPaused; private float _levelTimer; + public Text timerText; void Awake() { DontDestroyOnLoad(this); + isPaused = true; } public bool isPaused @@ -22,19 +25,19 @@ public class GameManager : SingletonBehaviour } set { - _isPaused = value; if (isPaused) { //set timescale back to normal - isPaused = false; + Time.timeScale = 1; Debug.Log("Game is unpaused"); } else { //set timescale to zero - isPaused = true; + Time.timeScale = 0; Debug.Log("Game is paused"); } + _isPaused = value; } } @@ -56,4 +59,18 @@ public class GameManager : SingletonBehaviour Debug.Log("Changing level state"); levelTimer = Time.time; } + //formats the time for the text object + private string formatTime(float time) + { + int minutes = Mathf.FloorToInt(time / 60F); + int seconds = Mathf.FloorToInt(time - minutes * 60); + return string.Format("{0:0}:{1:00}", minutes, seconds); + } + //updates the text object + void Update() + { + string currentTime = formatTime(Time.time - levelTimer); + timerText.text = "Time: " + currentTime; + } + }