private static void PerfomMainLoop(MagicWand magicWand) { while (true) { Console.WriteLine(); Console.Write("Wave your magic wand left or right: "); char typedChar = Console.ReadKey().KeyChar; if ((typedChar == 'E') || (typedChar == 'e')) { return; } else if ((typedChar == 'L') || (typedChar == 'l')) { Console.WriteLine(); magicWand.WaveLeft(); } else if ((typedChar == 'R') || (typedChar == 'r')) { Console.WriteLine(); magicWand.WaveRight(); } else { Console.WriteLine(); } } }
static void Main(string[] args) { List <ISpell> spells = MakeMagicSpells(); MagicWand magicWand = new MagicWand(); spells.ForEach(s => magicWand.AddSpell(s)); PerfomMainLoop(magicWand); }