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()); }
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(); }
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()); }