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(); }
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(); }
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(); }
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(); }
public EnemyRobotAdapter(EnemyRobot enemyRobot) { _enemyRobot = enemyRobot; }
public EnemyRobotAdapter(EnemyRobot newRobot) { theRobot = newRobot; }
public EnemyRobotAdapter(EnemyRobot r) { robot = r; }
public Adapter(EnemyRobot e) { enemyRobot = e; }