static PotionCollection Menu() { PotionCollection collection = new PotionCollection(); collection[0] = new Potion("Draught of Weakness", 80, new DraughtofWeakness()); collection[1] = new Potion("Draught of Fixation", 80, new DraughtofFixation()); collection[2] = new Potion("Flask of Mortality", 70, new FlaskofMortality()); collection[5] = new Potion("Elixir of Revelations", 85, new ElixirofRevelations()); Console.WriteLine("After many days of travel, you enter a tavern owned by a very strange person"); System.Threading.Thread.Sleep(2000); Console.WriteLine("The Shopkeeper welcomes you, kind sir!"); System.Threading.Thread.Sleep(3000); Console.WriteLine("Please, have a look at my recipes of my potions. If you like one, my wizard will make it for you for very good price!"); System.Threading.Thread.Sleep(2000); Console.WriteLine("Oh, I forgot to add. If you order more than 5 potions, you get a discount of 7 percent! Only today!"); System.Threading.Thread.Sleep(2000); Console.WriteLine("-----------------------------------------------"); Console.WriteLine("---------------------|Potions|---------------------"); PotionIterator iterator = collection.CreateIterator(); for (Potion item = iterator.First(); !iterator.IsDone; item = iterator.Next()) { Console.WriteLine(iterator.ItemIndex + 1 + ")" + item.Name + "\t" + item.Price + " gold coins"); } return(collection); }
public PotionIterator(PotionCollection Potions) { _Potions = Potions; }