public static void Main() { List <IWaterVehicle> waterVehicles = new List <IWaterVehicle>(); MasterCraft myBoat = new MasterCraft(10, "good transmission", 68.0, 87.0); Pontoon mySlowBoat = new Pontoon(16, "old transmission", 44.0, 13.0); JetSki mySpeedBoat = new JetSki(2, "awesome transmission", 30.0, 100.99); waterVehicles.Add(myBoat); waterVehicles.Add(mySlowBoat); waterVehicles.Add(mySpeedBoat); waterVehicles.ForEach(vehicle => { vehicle.Start(); vehicle.Drive(); vehicle.Stop(); }); // Build a collection of all vehicles that fly // With a single `foreach`, have each vehicle Fly() // Build a collection of all vehicles that operate on roads // With a single `foreach`, have each road vehicle Drive() // Build a collection of all vehicles that operate on water // With a single `foreach`, have each water vehicle Drive() }
public void Set_craft(string mastercraft) { this.Craft = MasterCraft.None; if (mastercraft == "Blacksmith") { this.Blacksmith = 2; this.SwordMastery = 1; this.Archery = 1; this.Craft = MasterCraft.Blacksmith; } else if (mastercraft == "Alchemy") { this.Alchemy = 3; this.Farm = 1; this.Craft = MasterCraft.Alchemy; } else if (mastercraft == "Warior") { this.SwordMastery = 2; this.Archery = 1; this.Blacksmith = 1; this.Craft = MasterCraft.Warior; } else if (mastercraft == "Archer") { this.Archery = 2; this.Alchemy = 1; this.Blacksmith = 1; this.Craft = MasterCraft.Archer; } else if (mastercraft == "Farm") { this.Farm = 4; this.Craft = MasterCraft.Farm; } else if (mastercraft == "Merchant") { this.Trade = 2; this.Farm = 2; this.Craft = MasterCraft.Merchant; } }
public CurrencyFactory( IFetchCurrencyValues currencyValueFetch, TransmutationOrb transmutation, AlterationOrb alteration, AugmentationOrb augmentation, AlchemyOrb alchemy, ChaosOrb chaos, RegalOrb regal, BlessedOrb blessed, ChanceOrb chance, DivineOrb divine, ExaltedOrb exalted, MasterCraft masterCraft, ScouringOrb scouring, // VaalOrb vaal, AnullmentOrb anull ) { Currency = new List <ICurrency> { transmutation, alteration, augmentation, alchemy, chaos, regal, blessed, chance, divine, exalted, masterCraft, scouring, // vaal, anull }; _currencyFetch = currencyValueFetch; }
public void Set_craft(MasterCraft masterCraft) { if (masterCraft == MasterCraft.Blacksmith) { this.Blacksmith = 2; this.SwordMastery = 1; this.Archery = 1; } else if (masterCraft == MasterCraft.Alchemy) { this.Alchemy = 3; this.Farm = 1; } else if (masterCraft == MasterCraft.Warior) { this.SwordMastery = 2; this.Archery = 1; this.Blacksmith = 1; } else if (masterCraft == MasterCraft.Archer) { this.Archery = 2; this.Alchemy = 1; this.Blacksmith = 1; } else if (masterCraft == MasterCraft.Farm) { this.Farm = 4; } else if (masterCraft == MasterCraft.Merchant) { this.Trade = 2; this.Farm = 2; } this.Craft = masterCraft; }