예제 #1
0
        private static void Main(string[] args)
        {
            Manipulator manipulator = new Manipulator();
            Console.WriteLine(manipulator.GetState());

            RemoteController controller = new RemoteController(manipulator);
            controller.Up(10);
            Console.WriteLine(manipulator.GetState());

            controller.Left(20);
            Console.WriteLine(manipulator.GetState());

            controller.Right(10);
            Console.WriteLine(manipulator.GetState());

            controller.Down(30);
            Console.WriteLine(manipulator.GetState());

            controller.UndoLastCommand();
            Console.WriteLine(manipulator.GetState());

            controller.UndoLastCommand();
            Console.WriteLine(manipulator.GetState());

            controller.UndoLastCommand();
            Console.WriteLine(manipulator.GetState());

            controller.UndoLastCommand();
            Console.WriteLine(manipulator.GetState());

            Console.ReadLine();
        }
예제 #2
0
 public RemoteController(Manipulator manipulator)
 {
     this.manipulator = manipulator;
 }
예제 #3
0
 public override void Undo(Manipulator manipulator)
 {
     manipulator.MoveVertical(Distance);
 }
예제 #4
0
 public override void Undo(Manipulator manipulator)
 {
     manipulator.MoveHorisontal(-Distance);
 }
예제 #5
0
 public abstract void Undo(Manipulator manipulator);