Skip to content

Commit fc9fb04

Browse files
committed
Fix timer values...again
1 parent 96e8aff commit fc9fb04

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

UnityPomodoro/Assets/AdrianMiasik/Scripts/PomodoroTimer.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public enum States
7272
// Time
7373
private double currentTime;
7474
private float totalTime; // In seconds
75+
private bool firstTimePlaying = true;
7576

7677
// Pause Fade Animation
7778
[Header("Fade Animation")]
@@ -484,6 +485,12 @@ public void HideInfo()
484485
/// </summary>
485486
public void Play()
486487
{
488+
if (firstTimePlaying)
489+
{
490+
firstTimePlaying = false;
491+
CalculateTimeValues();
492+
}
493+
487494
SwitchState(States.RUNNING);
488495
}
489496

@@ -502,6 +509,7 @@ public void SwitchToBreakTimer()
502509
{
503510
digitFormat.isOnBreak = true;
504511
SwitchState(States.SETUP);
512+
firstTimePlaying = true;
505513
CalculateTimeValues();
506514
}
507515

@@ -512,6 +520,7 @@ public void SwitchToWorkTimer()
512520
{
513521
digitFormat.isOnBreak = false;
514522
SwitchState(States.SETUP);
523+
firstTimePlaying = true;
515524
CalculateTimeValues();
516525
}
517526

@@ -527,6 +536,7 @@ public void Restart(bool _isCompleted)
527536
}
528537

529538
SwitchState(States.SETUP);
539+
firstTimePlaying = true;
530540
CalculateTimeValues();
531541

532542
// Stop digit tick animation

0 commit comments

Comments
 (0)