Fixed some timer bugs
Timer now has a mode for unscaled time FIXED: Countdown now resets properly
This commit is contained in:
parent
750d7f6b88
commit
a4c26426e5
5 changed files with 53 additions and 9 deletions
|
@ -6,7 +6,14 @@ using TMPro;
|
|||
|
||||
namespace SimpleTools.Timer{
|
||||
public static class TimerUtility {
|
||||
public static Timer SetupTimer(this TMP_Text container, TimerType timerType, float countdownTime = 60f){
|
||||
/// <summary>
|
||||
/// Setup the timer
|
||||
/// </summary>
|
||||
/// <param name="container">TMPro object that will contain the timer</param>
|
||||
/// <param name="timerType">What type of timer will it be (Countdown, Stopwatch, Clock)</param>
|
||||
/// <param name="countdownTime">The time that will have in case it is a countdown timer</param>
|
||||
/// <returns></returns>
|
||||
public static Timer SetupTimer(this TMP_Text container, TimerType timerType, TimerUpdate timerUpdate, float countdownTime = 60f){
|
||||
Timer t = container.gameObject.AddComponent<Timer>();
|
||||
float elapsedTime = 0f;
|
||||
string text = string.Empty;
|
||||
|
@ -21,7 +28,7 @@ namespace SimpleTools.Timer{
|
|||
text = DateTime.Now.ToString("HH:mm:ss");
|
||||
break;
|
||||
}
|
||||
t.Setup(elapsedTime, true, timePlaying, container, timerType, text);
|
||||
t.Setup(elapsedTime, true, timePlaying, container, timerType, timerUpdate, text);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue