Exemplo n.º 1
0
        static void Main(string[] args)
        {
            EnemyTank rx7Tank = new EnemyTank();

            EnemyRobot fredTheRobot = new EnemyRobot();

            EnemyAttacker robotAdapter = new EnemyRobotAdapter(fredTheRobot);

            Console.WriteLine("The Robot");

            fredTheRobot.ReactToHuman("Paul");
            fredTheRobot.WalkForward();
            fredTheRobot.SmashWithHands();
            Console.WriteLine();

            Console.WriteLine("The Enemy Tank");

            rx7Tank.AssignDriver("Frank");
            rx7Tank.DriveForward();
            rx7Tank.FireWeapon();
            Console.WriteLine();

            Console.WriteLine("The Robot with Adapter");

            robotAdapter.AssignDriver("Mark");
            robotAdapter.DriveForward();
            robotAdapter.FireWeapon();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            EnemyTank     tank         = new EnemyTank();
            EnemyRobot    robo         = new EnemyRobot();
            EnemyAttacker robotAdapter = new EnemyRobotAdapter(robo);

            robo.reactToHuman("Me");
            robo.walkForward();

            tank.assignDriver("Frank");
            tank.driveFW();

            robotAdapter.assignDriver("Gaby");
            robotAdapter.driveFW();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            EnemyTank  tank  = new EnemyTank();
            EnemyRobot robot = new EnemyRobot();

            IEnemyAttack robotAdapter = new EnemyRobotAdapter(robot);

            Console.WriteLine("======== ROBO ========");
            robot.React("FS34");
            robot.MoveForward();
            robot.Smash();

            Console.WriteLine("======== TANK ========");
            tank.Drive("FS34");
            tank.Move();
            tank.FireGun();

            Console.WriteLine("======== ROBOT ADPTER ========");
            robotAdapter.Drive("C3PO");
            robotAdapter.Move();
            robotAdapter.FireGun();

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

            EnemyRobot fredTheRobot = new EnemyRobot();

            EnemyRobotAdapter robotAdapter = new EnemyRobotAdapter(fredTheRobot);

            Console.WriteLine("The Robot");

            fredTheRobot.ReactToHuman("Paul");
            fredTheRobot.WalkForward();
            fredTheRobot.SmashWithHands();

            Console.WriteLine("The Enemy Tank");
            rx7Tank.AssignAttacker("Frank");
            rx7Tank.DriveForward();
            rx7Tank.FireWeapon();

            Console.WriteLine("The Robot with Adapter");
            robotAdapter.AssignAttacker("Mark");
            robotAdapter.DriveForward();
            robotAdapter.FireWeapon();
        }