private void InitializeSettings() { // Get and set the player name var playerName = _handleInput.GetPlayerName(); _loadPlayer.GetPlayerInstance().Name = playerName; // Get size of the maze matrix _sizeOfMaze = _handleInput.GetSizeOfMaze(); _mazeIntegration.BuildMaze(_sizeOfMaze); // Set player on the entrance room _loadPlayer.GetPlayerInstance().CurrentRoom = _loadMaze.GetMazeMapInstance().mazeRooms.Where(r => r.IsEntrance).FirstOrDefault(); _loadPlayer.GetPlayerInstance().HitPoints = _sizeOfMaze / 2; }
public void NewGame() { _mazeLayout.Size = GetRandomMazeSize(); // Build Maze try { Console.WriteLine("Generating maze of size {0}", _mazeLayout.Size); _mazeIntegration.BuildMaze(_mazeLayout.Size); Console.WriteLine("Maze generation succeeded!"); } catch (Exception e) { Console.WriteLine(e.StackTrace.ToString()); Console.ReadLine(); Environment.Exit(0); } }
private void NewGameState(ConsoleKey key) { _input.clearInput(); var mazeSize = _input.ToNumber(key); if (mazeSize == null) { _render.Message(MessageTypes.InvalidInput); } else if (mazeSize <= 1) { _render.Message(MessageTypes.InvalidInput); } else { //---------Build the maze and get the entrance room ----------- _play = new Play(); _play.MazeSize = mazeSize.Value; _mazeIntegration.BuildMaze(_play.MazeSize); _play.CurrentRoom = _mazeIntegration.GetEntranceRoom(); string desc = _mazeIntegration.GetDescription(_play.CurrentRoom); //---------Render the maze and the moves ----------- _play.VisitedRooms.Add(new Room() { Description = desc, HasTrap = false, HasTreasure = false, RoomId = _play.CurrentRoom }); _render.EntranceRoom(_play.CurrentRoom); _render.Message(MessageTypes.Instruction); _render.Moves(_play); _currentState = State.InProgress; } }