Beispiel #1
0
        /// <summary>
        /// Draws the room to the console.
        /// </summary>
        public void Draw()
        {
            for (int row = 0; row < displayGrid.GetLength(0); row++)
            {
                for (int column = 0; column < displayGrid.GetLength(1); column++)
                {
                    Coordinate CurrentPosition = new Coordinate(row, column);
                    // Get any character that is at the current coordinate.
                    Character character = roomCharacters.Find(Character => Character.Location.Equals(CurrentPosition));

                    // Set the edge tiles to visible.
                    if (row == 0 || row == displayGrid.GetLength(0) - 1 || column == 0 || column == displayGrid.GetLength(1) - 1)
                    {
                        displayGrid[row, column].IsVisible = true;
                    }

                    // If there is a character at this coordinate, draw them first.
                    if (character != null)
                    {
                        character.Draw();
                    }
                    else
                    {
                        displayGrid[row, column].Draw();
                    }
                }

                Console.WriteLine();
            }
        }