Beispiel #1
0
        public override void OnExit(MyContext context, SuperState newState)
        {
            if (ParentOf(newState)) return;

            Console.WriteLine("AA - Run on exit code");
            base.OnExit(context, newState);
        }
Beispiel #2
0
        public override void OnEnter(MyContext context, SuperState oldState)
        {
            if (ParentOf(oldState)) return;

            base.OnEnter(context, oldState);
            Console.WriteLine("AB - Run on enter code");
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("# Starting in A");
            var stm = new MyContext();

            Console.WriteLine("\n# Going to B");
            stm.State.GotoB(stm);

            Console.WriteLine("\n# Going to AA");
            stm.State.GotoAA(stm);

            Console.WriteLine("\n# Going to AA");
            stm.State.GotoAB(stm);

            Console.WriteLine("\n# Going to B");
            stm.State.GotoB(stm);

            Console.WriteLine("\n# Going to A");
            stm.State.GotoA(stm);
        }
Beispiel #4
0
 public virtual void GotoB(MyContext context)
 {
     var newState = new B();
     context.LeaveState(newState);
     Console.WriteLine("Going To B Action");
     context.SetState(newState, this);
 }
Beispiel #5
0
 public virtual void OnExit(MyContext context, SuperState newState)
 {
 }