Пример #1
0
        public void Change(ActorState.Name nextState, IActorStateContext context)
        {
            Assert.IsTrue(this.states.ContainsKey(nextState), $"{nextState}に対応した{typeof(IActorState)}が存在しません");

            this.states[this.currentState].Exit(nextState);
            this.currentState = nextState;
            this.states[this.currentState].Enter(context);
        }
Пример #2
0
        public ActorStateManager(Actor owner)
        {
            this.owner = owner;

            this.states.Add(ActorState.Name.Idle, new States.Idle(this.owner));
            this.states.Add(ActorState.Name.Run, new Run(this.owner));
            this.states.Add(ActorState.Name.Jump, new Jump(this.owner));
            this.states.Add(ActorState.Name.Fall, new States.Fall(this.owner));
            this.states.Add(ActorState.Name.Attack, new Attack(this.owner));
            this.states.Add(ActorState.Name.Knockback, new Knockback(this.owner));

            this.currentState = ActorState.Name.Idle;
            this.states[this.currentState].Enter(null);

            this.AnyEnterState();
        }
Пример #3
0
 public virtual void Exit(ActorState.Name nextState)
 {
     this.events.Clear();
 }
Пример #4
0
 public void Change(ActorState.Name nextState)
 {
     this.Change(nextState, null);
 }