static void Main(string[] args) { EnemyShipFactory factory = new EnemyShipFactory(); Console.WriteLine("What tipe of ship? ( U / R )"); var lire = Console.ReadLine(); factory.MakeEnemyShip(lire); DoStuffEnemy(factory.MakeEnemyShip(lire)); }
static void Main(string[] args) { EnemyShip enemyShip = null; Console.WriteLine("What type of ship? (U / R / B)"); var enemyShipOption = Console.ReadLine().ToUpper(); EnemyShipFactory shipFactory = new EnemyShipFactory(); enemyShip = shipFactory.MakeEnemyShip(enemyShipOption); doStuffEnemy(enemyShip); Console.ReadKey(); }
private static void Main(string[] args) { Console.WriteLine("Enter the type of ship"); var input = Console.ReadLine(); var factory = new EnemyShipFactory(); var ship = factory.MakeEnemyShip(input); if (ship != null) { DoStuff(ship); } else { Console.WriteLine("Invalid input!"); } }