File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
UnityPomodoro/Assets/AdrianMiasik/Scripts Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments