mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-03-02 22:31:10 +00:00
feat: add state machine
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Assets._Project.Develop.Runtime.Utilities.StateMachineCore
|
||||
{
|
||||
public class StateNode<TState> where TState : class, IState
|
||||
{
|
||||
private List<StateTransition<TState>> _transitions = new();
|
||||
|
||||
public StateNode(TState state)
|
||||
{
|
||||
State = state;
|
||||
}
|
||||
|
||||
public TState State { get; }
|
||||
|
||||
public IReadOnlyList<StateTransition<TState>> Transitions => _transitions;
|
||||
|
||||
public void AddTransition(StateTransition<TState> transition) => _transitions.Add(transition);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user