feat: safe delegate invocation helper added
This commit is contained in:
@@ -16,21 +16,21 @@ public abstract class StateBehaviourBase : Behaviour, IState
|
||||
public void Update()
|
||||
{
|
||||
OnUpdateState();
|
||||
OnStateUpdate?.Invoke(this);
|
||||
OnStateUpdate?.InvokeSafe(this);
|
||||
}
|
||||
|
||||
protected virtual void OnTransitionedToState(IState from) { }
|
||||
public void TransitionTo(IState from)
|
||||
{
|
||||
OnTransitionedToState(from);
|
||||
OnStateTransitionedTo?.Invoke(this, from);
|
||||
OnStateTransitionedTo?.InvokeSafe(this, from);
|
||||
}
|
||||
|
||||
protected virtual void OnTransitionedFromState(IState to) { }
|
||||
public void TransitionFrom(IState to)
|
||||
{
|
||||
OnTransitionedFromState(to);
|
||||
OnStateTransitionedFrom?.Invoke(this, to);
|
||||
OnStateTransitionedFrom?.InvokeSafe(this, to);
|
||||
}
|
||||
|
||||
public abstract IState? GetNextState();
|
||||
|
Reference in New Issue
Block a user