Пример #1
0
        // The Draw method will be called each time the map is updated
        // It will render all of the symbols/colors for each cell to the map sub console
        public void Draw(RLConsole mapConsole, RLConsole statConsole)
        {
            foreach (Cell cell in GetAllCells())
            {
                SetConsoleSymbolForCell(mapConsole, cell);
            }
            // Iterate through each monster on the map and draw it after drawing the Cells
            // Keep an index so we know which position to draw monster stats at
            int i = 0;

            // Iterate through each monster on the map and draw it after drawing the Cells
            foreach (Monster monster in _monsters)
            {
                // When the monster is in the field-of-view also draw their stats
                if (IsInFov(monster.X, monster.Y))
                {
                    monster.Draw(mapConsole, this);

                    // Pass in the index to DrawStats and increment it afterwards
                    monster.DrawStats(statConsole, i);
                    i++;
                }
            }

            foreach (Door door in Doors)
            {
                door.Draw(mapConsole, this);
            }

            StairsUp.Draw(mapConsole, this);
            StairsDown.Draw(mapConsole, this);
        }
Пример #2
0
        // The Draw method will be called each time the map is updated
        // It will render all of the symbols/colors for each cell to the map sub console
        public virtual void Draw(RLConsole mapConsole, RLConsole statConsole, bool NextAnimation)
        {
            // Sets the right symbol for every cell of the map
            foreach (Cell cell in GetAllCells())
            {
                SetConsoleSymbolForCell(mapConsole, cell);
            }

            // Draws the 2 stairs in the map
            StairsUp.Draw(mapConsole, this, false);
            StairsDown.Draw(mapConsole, this, false);


            DrawPuzzlePieces(mapConsole);


            foreach (Item item in Items)
            {
                item.Draw(mapConsole, this, false);
            }

            // Places the monsters after the doors,stairs and items so they appear above them
            int i = 0;

            foreach (Monster monster in _monsters)
            {
                monster.Draw(mapConsole, this, NextAnimation);
                if (IsInFov(monster.X, monster.Y))
                {
                    monster.DrawStats(statConsole, i);
                    i++;
                }
            }
        }
Пример #3
0
        //Draws the map to the screen
        public void Draw(RLConsole mapConsole, RLConsole statsConsole)
        {
            //For each cell that exists, set the symbol based on
            //      logic provided in SetSymbolForCell
            foreach (Cell cell in GetAllCells())
            {
                SetSymbolForCell(mapConsole, cell);
            }

            //Draws the stairs up
            StairsUp.Draw(mapConsole, this);
            //Draws the stairs down and instantiates the interactive
            //      object
            StairsDown.Draw(mapConsole, this);

            //Draws the open chest
            ChestOpen.Draw(mapConsole, this);
            //Draws the closed chest and instantiates the interactive
            //      object
            ChestClosed.Draw(mapConsole, this);

            int i = 0;

            foreach (Monster monster in _monsters)
            {
                monster.Draw(mapConsole, this);
                if (IsInFov(monster.X, monster.Y))
                {
                    monster.DrawStats(statsConsole, i);
                    i++;
                }
            }
        }
Пример #4
0
        public void Draw(RLConsole mapConsole)
        {
            mapConsole.Clear();
            foreach (Cell cell in GetAllCells())
            {
                SetConsoleSymbolForCell(mapConsole, cell);
            }
            foreach (Monster monster in _monsters)
            {
                monster.Draw(mapConsole, this);
            }

            foreach (KeyValuePair <Point, Pickup> pickup in _pickups)
            {
                pickup.Value.Draw(mapConsole, this, pickup.Key);
            }
            StairsDown.Draw(mapConsole, this);
        }
Пример #5
0
        //The Draw method will be called each time the map is updated
        //It will render all of the symbols or colors for each cell to the map sub console we created earlier
        public void Draw(RLConsole mapConsole, RLConsole statConsole)
        {
            //ineffecient too redraw code everytime
            //clear what was previously on the map console
            //mapConsole.Clear();



            //foreach of the cells in the
            foreach (Cell cell in GetAllCells())
            {
                SetConsoleSymbolForCell(mapConsole, cell);
            }

            foreach (Door door in Doors)
            {
                door.Draw(mapConsole, this);
            }

            StairsUp.Draw(mapConsole, this);
            StairsDown.Draw(mapConsole, this);

            //keep an index so we know which position to draw monster stats at
            int i = 0;

            foreach (TreasurePile treasurePile in _treasurePiles)
            {
                IDrawable drawableTreasure = treasurePile.Treasure as IDrawable;
                drawableTreasure?.Draw(mapConsole, this);
            }

            foreach (Monster monster in _monsters)
            {
                monster.Draw(mapConsole, this);

                //if a monster is in field of view draw there stats too the stat console
                if (IsInFov(monster.X, monster.Y))
                {
                    monster.DrawStats(statConsole, i);
                    i++;
                }
            }
        }