Example #1
0
        static void Main(string[] args)
        {
            FSMSystem       fsm    = new FSMSystem();
            FollowPathState follow = new FollowPathState(fsm);

            follow.AddTransition(Transition.SawPlayer, StateID.ChasingPlayer);
            ChasePlayerState chase = new ChasePlayerState(fsm);

            chase.AddTransition(Transition.LostPlayer, StateID.FollowingPath);
            fsm.AddState(follow);
            fsm.AddState(chase);

            fsm.CurrentState.Reason(31);
            fsm.CurrentState.Act();

            fsm.CurrentState.Reason(14);
            fsm.CurrentState.Act();

            fsm.CurrentState.Reason(13);
            fsm.CurrentState.Act();

            fsm.CurrentState.Reason(32);
            fsm.CurrentState.Act();

            fsm.CurrentState.Reason(16);
            fsm.CurrentState.Act();
            Console.ReadKey();
        }
Example #2
0
 public ChasePlayerState(FSMSystem sys)
 {
     stateID  = StateID.ChasingPlayer;
     this.sys = sys;
 }
Example #3
0
 public FollowPathState(FSMSystem sys)
 {
     stateID  = StateID.FollowingPath;
     this.sys = sys;
 }