Gruppe22.Client.Mainmap._drawFloor C# (CSharp) Méthode

_drawFloor() private méthode

Display the floor (using "rugged edges" to hide isometric-pattern)
private _drawFloor ( ) : void
Résultat void
        private void _drawFloor()
        {
            Backend.Coords currentPos = _map.actors[_playerID].tile.coords;
            for (int y = (Math.Max(currentPos.y - Math.Max(_map.actors[_playerID].viewRange, _map.light), 0)); y < (Math.Min(currentPos.y + Math.Max(_map.actors[_playerID].viewRange, _map.light) + 1, _map.height)); ++y)
            {
                for (int x = (Math.Max(currentPos.x - Math.Max(_map.actors[_playerID].viewRange, _map.light), 0)); x < (Math.Min(currentPos.x + Math.Max(_map.actors[_playerID].viewRange, _map.light) + 1, _map.width)); ++x)
                {
                    WallDir dir = GetWallStyle(x, y, false, 0);
                    switch (dir)
                    {

                        case WallDir.DiagUpDownClose: // Done
                            break;

                        case WallDir.DiagUpDownClose2: // Done
                            break;

                        case WallDir.DiagLeftRightClose: // Done
                            break;

                        case WallDir.DiagLeftRightClose2: // Done
                            break;

                        default:
                            _spriteBatch.Draw(_floors[(int)dir].animationTexture, _tileRect(new Vector2(x, y)),
                                _floors[(int)dir].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);
                            break;

                    }
                }
            }

            for (int y = (Math.Max(currentPos.y - Math.Max(_map.actors[_playerID].viewRange, _map.light), 0)); y < (Math.Min(currentPos.y + Math.Max(_map.actors[_playerID].viewRange, _map.light) + 1, _map.height)); ++y)
            {
                for (int x = (Math.Max(currentPos.x - Math.Max(_map.actors[_playerID].viewRange, _map.light), 0)); x < (Math.Min(currentPos.x + Math.Max(_map.actors[_playerID].viewRange, _map.light) + 1, _map.width)); ++x)
                {

                    if (_map[x, y].hasTrap)
                    {
                        if (_map[x, y].trap.status != Backend.TrapState.NoDisplay)
                        {
                            if (!_map[x, y].trap.visible)
                            {
                                _spriteBatch.Draw(_environment[0][9].animationTexture, new Rectangle(_map2screen(x, y).x + 32, _map2screen(x, y).y + 16, 64, 64), _environment[0][9].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);
                            }
                            else
                            {
                                _spriteBatch.Draw(_environment[0][10].animationTexture, new Rectangle(_map2screen(x, y).x + 32, _map2screen(x, y).y + 16, 64, 64), _environment[0][10].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);
                            }
                        }
                    }
                    if (_map[x, y].hasCheckpoint)
                    {
                        _spriteBatch.Draw(_environment[0][24].animationTexture, new Rectangle(_map2screen(x, y).x, _map2screen(x, y).y, 128, 96), _environment[0][24].animationRect, (_map[x, y].checkpoint.visited) ? new Color(Color.Black, 0.4f) : ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);
                    }
                    if (_map[x, y].hasTarget)
                    {
                        _spriteBatch.Draw(_environment[0][23].animationTexture, new Rectangle(_map2screen(x, y).x + 32, _map2screen(x, y).y + 16, 64, 48), _environment[0][23].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);
                    }
                    if (_map[x, y].hasTeleport)
                    {
                        if (!_map[x, y].teleport.teleport)
                        {
                            if ((x == 0) && (y == 0))
                            {

                                _environment[0][8].NextAnimation();
                                _spriteBatch.Draw(_environment[0][8].animationTexture, new Rectangle(_map2screen(x, y).x + 32, _map2screen(x, y).y + 16, 64, 48), _environment[0][8].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);

                            }

                            else if ((x == 0) && (y == _map.height - 1))
                            {
                                _environment[0][5].NextAnimation();
                                _spriteBatch.Draw(_environment[0][5].animationTexture, new Rectangle(_map2screen(x, y).x + 32, _map2screen(x, y).y + 16, 64, 48), _environment[0][5].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);

                            }
                            else if ((x == _map.width - 1) && (y == 0))
                            {
                                _environment[0][2].NextAnimation();
                                _spriteBatch.Draw(_environment[0][2].animationTexture, new Rectangle(_map2screen(x, y).x + 32, _map2screen(x, y).y + 16, 64, 48), _environment[0][2].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);

                            }
                            else if ((x == _map.width - 1) && (y == _map.height - 1))
                            {
                                _environment[0][1].NextAnimation();
                                _spriteBatch.Draw(_environment[0][1].animationTexture, new Rectangle(_map2screen(x, y).x + 32, _map2screen(x, y).y + 16, 64, 48), _environment[0][1].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);

                            }
                            else if (y == _map.height - 1)
                            {
                                _environment[0][6].NextAnimation();
                                _spriteBatch.Draw(_environment[0][6].animationTexture, new Rectangle(_map2screen(x, y).x + 32, _map2screen(x, y).y + 16, 64, 48), _environment[0][6].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);
                            }
                            else if (y == 0)
                            {

                                _environment[0][4].NextAnimation();
                                _spriteBatch.Draw(_environment[0][4].animationTexture, new Rectangle(_map2screen(x, y).x + 32, _map2screen(x, y).y + 16, 64, 48), _environment[0][4].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);

                            }
                            else if (x == 0)
                            {
                                _environment[0][7].NextAnimation();
                                _spriteBatch.Draw(_environment[0][7].animationTexture, new Rectangle(_map2screen(x, y).x + 32, _map2screen(x, y).y + 16, 64, 48), _environment[0][7].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);
                            }
                            else if (x == _map.width - 1)
                            {
                                _environment[0][3].NextAnimation();
                                _spriteBatch.Draw(_environment[0][3].animationTexture, new Rectangle(_map2screen(x, y).x + 32, _map2screen(x, y).y + 16, 64, 48), _environment[0][3].animationRect, ((y == (int)_highlightedTile.y) && (x == (int)_highlightedTile.x)) ? Color.Red : Color.White);

                            }

                        }
                    }
                }
            }
            //TODO: Reimplement rugged tiles
        }