SetInitialState() public method

public SetInitialState ( ComponentState id ) : void
id ComponentState
return void
Esempio n. 1
0
        public static IArea WithStateMachine(this IArea area, Enum id, Action <StateMachine, IArea> initializer)
        {
            if (area == null)
            {
                throw new ArgumentNullException(nameof(area));
            }
            if (initializer == null)
            {
                throw new ArgumentNullException(nameof(initializer));
            }

            var stateMachine = new StateMachine(
                ComponentIdFactory.Create(area.Id, id));

            initializer(stateMachine, area);
            stateMachine.SetInitialState(BinaryStateId.Off);

            area.AddComponent(stateMachine);
            return(area);
        }
        public IStateMachine RegisterStateMachine(IArea area, Enum id, Action<StateMachine, IArea> initializer)
        {
            if (area == null) throw new ArgumentNullException(nameof(area));
            if (initializer == null) throw new ArgumentNullException(nameof(initializer));

            var stateMachine = new StateMachine(ComponentIdGenerator.Generate(area.Id, id));

            initializer(stateMachine, area);
            stateMachine.SetInitialState(BinaryStateId.Off);

            area.AddComponent(stateMachine);
            return stateMachine;
        }