mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-03-02 14:29:23 +00:00
33 lines
749 B
C#
33 lines
749 B
C#
using System.Collections.Generic;
|
|
|
|
namespace Assets._Project.Develop.Runtime.Utilities.StateMachineCore
|
|
{
|
|
public abstract class ParallelState<TState> : State where TState : class, IState
|
|
{
|
|
private List<TState> _states;
|
|
|
|
public ParallelState(params TState[] states)
|
|
{
|
|
_states = new List<TState>(states);
|
|
}
|
|
|
|
protected IReadOnlyList<TState> States => _states;
|
|
|
|
public override void Enter()
|
|
{
|
|
base.Enter();
|
|
|
|
foreach (TState state in _states)
|
|
state.Enter();
|
|
}
|
|
|
|
public override void Exit()
|
|
{
|
|
base.Exit();
|
|
|
|
foreach (TState state in _states)
|
|
state.Exit();
|
|
}
|
|
}
|
|
}
|