static void Main(string[] args)
        {
            BeginState   begin   = new BeginState();
            RunningState running = new RunningState();
            EndState     end     = new EndState();
            FsmSystem    fsm     = new FsmSystem()
            {
                states =
                {
                    begin, running, end
                }
            };

            fsm.current = fsm.states[0];
            fsm.ChangeState(begin);

            Console.ReadKey();
        }
 public override void OnUpdate(FsmSystem fsmOwner)
 {
     base.OnUpdate(fsmOwner);
     Console.WriteLine("离开{0}", typeof(RunningState).ToString());
 }
 public override void OnLeave(FsmSystem fsmOwner)
 {
     base.OnLeave(fsmOwner);
 }
 public override void OnInit(FsmSystem fsmOwner)
 {
     base.OnInit(fsmOwner);
 }
Exemple #5
0
 public override void OnEnter(FsmSystem fsmOwner)
 {
     base.OnEnter(fsmOwner);
     Console.WriteLine("进入{0}", typeof(BeginState).ToString());
 }
 public virtual void OnLeave(FsmSystem fsmOwner)
 {
 }
 public virtual void OnUpdate(FsmSystem fsmOwner)
 {
 }
 public virtual void OnEnter(FsmSystem fsmOwner)
 {
 }
 public virtual void OnInit(FsmSystem fsmOwner)
 {
 }