Exemplo n.º 1
0
        public void RenderMap(GamePlayManager gamePlayManager)
        {
            Point currentPlayerPosition = gamePlayManager.Player.CurrentPlayerPosition;

            ExploreTilesAroundPlayer(gamePlayManager, currentPlayerPosition);
            ConsoleHandler.WriteCharAt(gamePlayManager.Player.Symbol, currentPlayerPosition, ConsoleColor.Gray);
            ConsoleHandler.WriteStringAt(gamePlayManager.Player.numberOfMoves.ToString(), new Point(18, 17));
            PrintInventory(gamePlayManager);
        }
Exemplo n.º 2
0
        public void PrintOutMap(GamePlayManager gamePlayManager)
        {
            foreach (var Tile in gamePlayManager.GameObjects)
            {
                if (Tile.IsExplored == true)
                {
                    ConsoleHandler.WriteCharAt(Tile.Symbol, Tile.Position, Tile.Color);
                }
            }

            ConsoleHandler.WriteCharAt(gamePlayManager.Player.Symbol, gamePlayManager.Player.CurrentPlayerPosition, ConsoleColor.Gray);
            ConsoleHandler.WriteStringAt($"Number of steps: {gamePlayManager.Player.numberOfMoves.ToString()}", new Point(18, 0));
            PrintInventory(gamePlayManager);
        }
Exemplo n.º 3
0
        public void Interact(GamePlayManager gamePlayerManager)
        {
            var tempTile = gamePlayerManager.GetTileAtPoint(new Point(6, 31));

            if (!tempTile.IsExplored)
            {
                gamePlayerManager.GameObjects.Remove(tempTile);
                gamePlayerManager.GameObjects.Add(new FloorTile(tempTile.Position, false));
            }
            else if (tempTile.IsExplored)
            {
                gamePlayerManager.GameObjects.Remove(tempTile);
                gamePlayerManager.GameObjects.Add(new FloorTile(tempTile.Position, true));
                ConsoleHandler.WriteCharAt(tempTile.Symbol, tempTile.Position, tempTile.Color);
            }
        }
Exemplo n.º 4
0
        private void ExploreTilesAroundPlayer(GamePlayManager gamePlayManager, Point currentPlayerPosition)
        {
            Point      point;
            GameObject tempTile;

            for (int row = currentPlayerPosition.row - 1; row < currentPlayerPosition.row + 2; row++)
            {
                for (int column = currentPlayerPosition.column - 1; column < currentPlayerPosition.column + 2; column++)
                {
                    point    = new Point(row, column);
                    tempTile = gamePlayManager.GetTileAtPoint(point);

                    ConsoleHandler.WriteCharAt(tempTile.Symbol, point, tempTile.Color);
                    tempTile.IsExplored = true;
                }
            }
        }