static void Main(string[] args) { BasicUnitConstructor unitConstructor = new BasicUnitConstructor(); Builder footmanBuilder = new FootmanBuilder(); Builder dragonBuilder = new DragonBuilder(); unitConstructor.Construct(footmanBuilder); UnitImplStrategy footman = footmanBuilder.GetUnit(); Console.WriteLine(footman); unitConstructor.Construct(dragonBuilder); UnitImplStrategy dragon = dragonBuilder.GetUnit(); Console.WriteLine(dragon); Console.WriteLine(); footman.Move(); dragon.Move(); Console.WriteLine("Footman gets magic item : boots of speed"); footman.SetMoveStrategy(new FastGroundUnit()); footman.Move(); Console.ReadKey(); }
public void Move(UnitImplStrategy unit) { Console.WriteLine($"{unit.Name} flies"); }
public void Move(UnitImplStrategy unit) { Console.WriteLine($"{unit.Name} walks faster"); }