Пример #1
0
        public void RenderGhosts(Graphics g, NPacMan.Game.Game game)
        {
            var cellSize = Sprites.PixelGrid;

            animated = !animated;

            foreach (var ghost in game.Ghosts.Values)
            {
                RenderGhost(g, cellSize, ghost);
            }
        }
Пример #2
0
        public void RenderPowerPills(Graphics g, NPacMan.Game.Game game)
        {
            var cellSize = Sprites.PixelGrid;

            var powerPills = game.PowerPills;

            foreach (var powerPill in powerPills)
            {
                var x = powerPill.X * cellSize;
                var y = powerPill.Y * cellSize;

                _sprites.RenderSprite(g, x, y, _sprites.PowerPill());
            }
        }
Пример #3
0
        public void RenderCoins(Graphics g, NPacMan.Game.Game game)
        {
            var cellSize = Sprites.PixelGrid;

            var coins = game.Coins;

            foreach (var coin in coins)
            {
                var x = coin.X * cellSize;
                var y = coin.Y * cellSize;

                _sprites.RenderSprite(g, x, y, _sprites.Coin());
            }
        }
Пример #4
0
        public void RenderWalls(Graphics g, NPacMan.Game.Game game)
        {
            _mapLayout.UpdateFromGame(game);
            var cellSize = Sprites.PixelGrid;

            for (int y = 0; y < _mapLayout.DisplayHeight; y++)
            {
                for (int x = 0; x < _mapLayout.DisplayWidth; x++)
                {
                    var posX = x * cellSize;
                    var posY = y * cellSize;
                    _sprites.RenderSprite(g, posX, posY, _sprites.Map(_mapLayout.BoardPieceToDisplay(x, y)));
                }
            }
        }
Пример #5
0
        public void RenderPacMan(Graphics g, NPacMan.Game.Game game)
        {
            var cellSize = Sprites.PixelGrid;

            var x = game.PacMan.Location.X * cellSize;
            var y = game.PacMan.Location.Y * cellSize;

            _pacManAnimationDelay++;
            if (_pacManAnimationDelay == 3)
            {
                if (game.Status == GameStatus.Alive)
                {
                    _pacManAnimation = (_pacManAnimation + 1) % 4;
                }
                else
                {
                    _pacManAnimation = (_pacManAnimation + 1) % 4;
                }
                _pacManAnimationDelay = 0;
            }

            _sprites.RenderSprite(g, x, y, _sprites.PacMan(game.PacMan.Direction, _pacManAnimation, game.Status == GameStatus.Dying));
        }