diff --git a/Engine.Systems/Time/IStopwatch.cs b/Engine.Systems/Time/IStopwatch.cs index 57c8227..46e3cbc 100644 --- a/Engine.Systems/Time/IStopwatch.cs +++ b/Engine.Systems/Time/IStopwatch.cs @@ -2,9 +2,9 @@ namespace Syntriax.Engine.Systems.Time; public interface IStopwatch : IReadOnlyStopwatch { - void StopwatchStart(); - void StopwatchStop(); + void Start(); + void Stop(); - void StopwatchPause(); - void StopwatchResume(); + void Pause(); + void Resume(); } diff --git a/Engine.Systems/Time/ITicker.cs b/Engine.Systems/Time/ITicker.cs index 081a021..8bb1fc2 100644 --- a/Engine.Systems/Time/ITicker.cs +++ b/Engine.Systems/Time/ITicker.cs @@ -5,7 +5,7 @@ public interface ITicker : IStopwatch event TickerTickEventHandler? OnTick; int TickCounter { get; } - double TickPeriod { get; set; } + double Period { get; set; } delegate void TickerTickEventHandler(ITicker sender); } diff --git a/Engine.Systems/Time/ITimer.cs b/Engine.Systems/Time/ITimer.cs index bc7b5ff..8e313f9 100644 --- a/Engine.Systems/Time/ITimer.cs +++ b/Engine.Systems/Time/ITimer.cs @@ -2,9 +2,9 @@ namespace Syntriax.Engine.Systems.Time; public interface ITimer : IReadOnlyTimer { - void TimerStart(double time); - void TimerStop(); + void Start(double time); + void Stop(); - void TimerPause(); - void TimerResume(); + void Pause(); + void Resume(); } diff --git a/Engine.Systems/Time/StopwatchBehaviour.cs b/Engine.Systems/Time/StopwatchBehaviour.cs index 1d59e80..1731c04 100644 --- a/Engine.Systems/Time/StopwatchBehaviour.cs +++ b/Engine.Systems/Time/StopwatchBehaviour.cs @@ -17,7 +17,7 @@ public class StopwatchBehaviour : Behaviour, IStopwatch private bool shouldBeTicking = false; private bool hasStartedTickingBefore = false; - public virtual void StopwatchStart() + public virtual void Start() { Time = 0f; @@ -28,7 +28,7 @@ public class StopwatchBehaviour : Behaviour, IStopwatch StartStopwatch(); } - public virtual void StopwatchStop() + public virtual void Stop() { if (!shouldBeTicking) return; @@ -56,7 +56,7 @@ public class StopwatchBehaviour : Behaviour, IStopwatch return; if (hasStartedTickingBefore) - StopwatchResume(); + Resume(); else StartStopwatch(); } @@ -66,16 +66,16 @@ public class StopwatchBehaviour : Behaviour, IStopwatch if (!shouldBeTicking || State is not TimerState.Ticking) return; - StopwatchPause(); + Pause(); } - public virtual void StopwatchPause() + public virtual void Pause() { State = TimerState.Paused; OnPaused?.Invoke(this); } - public virtual void StopwatchResume() + public virtual void Resume() { State = TimerState.Ticking; OnResumed?.Invoke(this); diff --git a/Engine.Systems/Time/TickerBehaviour.cs b/Engine.Systems/Time/TickerBehaviour.cs index d1ab2f0..c20acb7 100644 --- a/Engine.Systems/Time/TickerBehaviour.cs +++ b/Engine.Systems/Time/TickerBehaviour.cs @@ -4,16 +4,16 @@ public class TickerBehaviour : StopwatchBehaviour, ITicker { public event ITicker.TickerTickEventHandler? OnTick = null; - public double TickPeriod { get; set; } = 1f; + public double Period { get; set; } = 1f; public int TickCounter { get; private set; } = 0; private double nextTick = 0f; - public override void StopwatchStart() + public override void Start() { TickCounter = 0; - base.StopwatchStart(); - nextTick = Time + TickPeriod; + base.Start(); + nextTick = Time + Period; } protected override void OnUpdate() @@ -23,7 +23,7 @@ public class TickerBehaviour : StopwatchBehaviour, ITicker if (Time < nextTick) return; - nextTick += TickPeriod; + nextTick += Period; TickCounter++; OnTick?.Invoke(this); } diff --git a/Engine.Systems/Time/TimerBehaviour.cs b/Engine.Systems/Time/TimerBehaviour.cs index afd4492..f88b5d4 100644 --- a/Engine.Systems/Time/TimerBehaviour.cs +++ b/Engine.Systems/Time/TimerBehaviour.cs @@ -31,7 +31,7 @@ public class TimerBehaviour : Behaviour, ITimer private bool shouldBeTicking = false; private bool hasStartedTickingBefore = false; - public virtual void TimerStart(double time) + public virtual void Start(double time) { StartTime = time; Remaining = time; @@ -43,7 +43,7 @@ public class TimerBehaviour : Behaviour, ITimer StartTimer(); } - public virtual void TimerStop() + public virtual void Stop() { if (!shouldBeTicking) return; @@ -65,7 +65,7 @@ public class TimerBehaviour : Behaviour, ITimer OnDelta?.Invoke(this, delta); if (Remaining <= .0f) - TimerStop(); + Stop(); } protected override void OnEnteredHierarchy(IGameManager gameManager) @@ -74,7 +74,7 @@ public class TimerBehaviour : Behaviour, ITimer return; if (hasStartedTickingBefore) - TimerResume(); + Resume(); else StartTimer(); } @@ -84,16 +84,16 @@ public class TimerBehaviour : Behaviour, ITimer if (!shouldBeTicking || State is not TimerState.Ticking) return; - TimerPause(); + Pause(); } - public virtual void TimerPause() + public virtual void Pause() { State = TimerState.Paused; OnPaused?.Invoke(this); } - public virtual void TimerResume() + public virtual void Resume() { State = TimerState.Ticking; OnResumed?.Invoke(this);