public void LoadGame(int mapIndex) { MapReader reader = new MapReader(Helper.Maps[mapIndex]); reader.Map(info => { switch (info.Type) { case "Block": AddBlock(info.Position); break; case "AI": AddBot(TankFactory.GetInstance().CreateTank(info.TankType, "E_50_Ausf_M", info.Position)); break; case "Player": Tank playerTank = TankFactory.GetInstance().CreateTank(info.TankType, "E_50_Ausf_M", info.Position); if (playerTank != null) { Cursor.GetCursor().Fire = playerTank.Fire; _player = new Player(playerTank); _gui = new DebugPanel(playerTank); } else { SafeExit(); } break; } }); }