PerformTransition() public method

This method tries to change the state the FSM is in based on the current state and the transition passed. If current state doesn't have a target state for the transition passed, an ERROR message is printed.
public PerformTransition ( FsmTransitionId trans ) : void
trans FsmTransitionId
return void
コード例 #1
0
        public void InitialState()
        {
            Prototype prototype = new Prototype();
            Alpha     alpha     = new Alpha();
            Release   release   = new Release();

            FsmSystem <State> fsm = new FsmSystem <State>();

            fsm.AddTransition(prototype, Transitions.Fix, alpha);
            fsm.AddTransition(alpha, Transitions.Optimize, release);

            fsm.SetInitialState(prototype);

            fsm.PerformTransition(Transitions.Fix);
            fsm.PerformTransition(Transitions.Optimize);

            Assert.AreEqual(fsm.GetCurrentState(), release);
        }
コード例 #2
0
    void BulletProcess()
    {
        EachObject((b) => {
            b.SetPosition(b.positionI.x + RL.Map.nDir [(int)b.direction, 0], b.positionI.y + RL.Map.nDir [(int)b.direction, 1]);
        }, RLCharacter.RLTypes.BULLET);

        OverlapCheck((b, m) => {
            objects.Remove(m);
            objects.Remove(b);
            Destroy(m.gameObject);
            Destroy(b.gameObject);
        }, RLCharacter.RLTypes.BULLET, RLCharacter.RLTypes.MONSTER);

        EachObject((b) => {
            if (!map.IsOpenTile(b.positionI.x, b.positionI.y))
            {
                objects.Remove(b);
                Destroy(b.gameObject);
            }
        }, RLCharacter.RLTypes.BULLET);

        fsm.PerformTransition(FsmTransitionId.Complete);
    }
コード例 #3
0
 // helper for the "Reason" method
 public void PerformTransition(FsmTransitionId trans)
 {
     Debug.Log("going to" + trans.ToString());
     machine.PerformTransition(trans);
 }
コード例 #4
0
ファイル: NPCControl.cs プロジェクト: AlbertWjw/Voxel-Game
 public void SetTransition(Transition t)
 {
     //该方法用来改变有限状态机的状体,有限状态机基于当前的状态和通过的过渡状态。
     //如果当前的状态没有用来通过的过度状态,则会抛出错误
     fsm.PerformTransition(t);
 }
コード例 #5
0
ファイル: Master.cs プロジェクト: luoshujie/Chess
 //设置状态机状态
 public void SetTransition(Transition trans)
 {
     fsm.PerformTransition(trans);
 }