Пример #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();
        }
Пример #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();
        }
Пример #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();
        }
Пример #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();
        }
Пример #5
0
 public EnemyRobotAdapter(EnemyRobot enemyRobot)
 {
     _enemyRobot = enemyRobot;
 }
Пример #6
0
 public EnemyRobotAdapter(EnemyRobot newRobot)
 {
     theRobot = newRobot;
 }
 public EnemyRobotAdapter(EnemyRobot r)
 {
     robot = r;
 }
 public Adapter(EnemyRobot e)
 {
     enemyRobot = e;
 }
 public EnemyRobotAdapter(EnemyRobot newRobot)
 {
     theRobot = newRobot;
 }