Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
 public RemoteController(Manipulator manipulator)
 {
     this.manipulator = manipulator;
 }
Ejemplo n.º 3
0
 public override void Undo(Manipulator manipulator)
 {
     manipulator.MoveVertical(Distance);
 }
Ejemplo n.º 4
0
 public override void Undo(Manipulator manipulator)
 {
     manipulator.MoveHorisontal(-Distance);
 }
Ejemplo n.º 5
0
 public abstract void Undo(Manipulator manipulator);