refactor: removed unnecessary overrides from Behaviour class

This commit is contained in:
2025-06-01 14:31:05 +03:00
parent f31b84f519
commit ac620264b1
7 changed files with 20 additions and 122 deletions

View File

@@ -3,7 +3,7 @@ using Syntriax.Engine.Core.Serialization;
namespace Syntriax.Engine.Systems.StateMachine;
public class StateMachine : Behaviour
public class StateMachine : Behaviour, IUpdate
{
public Event<StateMachine, StateChangedArguments> OnStateChanged { get; } = new();
@@ -44,7 +44,7 @@ public class StateMachine : Behaviour
State = nextState;
}
protected override void OnUpdate()
public void Update()
{
if (State is null)
return;

View File

@@ -2,7 +2,7 @@ using Syntriax.Engine.Core;
namespace Syntriax.Engine.Systems.Time;
public class StopwatchBehaviour : Behaviour, IStopwatch
public class StopwatchBehaviour : Behaviour, IUpdate, IStopwatch
{
public Event<IReadOnlyStopwatch> OnStarted { get; } = new();
public Event<IReadOnlyStopwatch, IReadOnlyStopwatch.StopwatchDeltaArguments> OnDelta { get; } = new();
@@ -38,7 +38,7 @@ public class StopwatchBehaviour : Behaviour, IStopwatch
OnStopped?.Invoke(this);
}
protected override void OnUpdate()
public virtual void Update()
{
if (State is not TimerState.Ticking)
return;

View File

@@ -18,9 +18,9 @@ public class TickerBehaviour : StopwatchBehaviour, ITicker
nextTick = Time + Period;
}
protected override void OnUpdate()
public override void Update()
{
base.OnUpdate();
base.Update();
while (Time > nextTick)
{

View File

@@ -2,7 +2,7 @@ using Syntriax.Engine.Core;
namespace Syntriax.Engine.Systems.Time;
public class TimerBehaviour : Behaviour, ITimer
public class TimerBehaviour : Behaviour, IUpdate, ITimer
{
public Event<IReadOnlyTimer> OnStarted { get; } = new();
public Event<IReadOnlyTimer, IReadOnlyTimer.TimerDeltaArguments> OnDelta { get; } = new();
@@ -53,7 +53,7 @@ public class TimerBehaviour : Behaviour, ITimer
OnStopped?.Invoke(this);
}
protected override void OnUpdate()
public void Update()
{
if (State is not TimerState.Ticking)
return;