static void Main(string[] args)
        {
            Context context    = new Context();
            IState  startState = new StartState();

            startState.DoAction(context);
            Console.WriteLine(context.GetState().MyState());
            IState stopState = new StopState();

            stopState.DoAction(context);
            Console.WriteLine(context.GetState().MyState());
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            Context context = new Context();

            StartState startState = new StartState();

            startState.DoAction(context);
            Console.WriteLine(context.GetState().ToString());

            StopState stopState = new StopState();

            stopState.DoAction(context);
            Console.WriteLine(context.GetState().ToString());

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            var context = new Context();

            var startState = new StartState();

            startState.Handle(context);

            Console.WriteLine(context.GetState().ToString());

            var stopState = new StopState();

            stopState.Handle(context);

            Console.WriteLine(context.GetState().ToString());

            Console.ReadKey();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Context context = new Context();

            ModifiedState modified = new ModifiedState();

            modified.DoAction(context);

            DeletedState deleted = new DeletedState();

            deleted.DoAction(context);

            Console.WriteLine(context.GetState());

            Console.ReadLine();
        }
 public void HandleControlls()
 {
     ExecuteStateMethods(gameContext.GetState());
 }