Gruppe22.Client.Mainmap._drawWall C# (CSharp) Method

_drawWall() private method

Display a wall
private _drawWall ( WallDir dir, Rectangle target, bool transparent, bool active, Backend special = Backend.WallType.Normal ) : void
dir WallDir Squares the wall connects to
target Microsoft.Xna.Framework.Rectangle
transparent bool
active bool
special Backend
return void
        private void _drawWall(WallDir dir, Rectangle target, bool transparent, bool active, Backend.WallType special = Backend.WallType.Normal)
        {
            if ((special != Backend.WallType.Normal) && (dir != WallDir.LeftRight) && (dir != WallDir.UpDown) && (dir != WallDir.UpLeftDiag)) special = Backend.WallType.Normal;

            switch (dir)
            {

                case WallDir.DiagUpDownClose: // Done
                    _drawWall(WallDir.DiagUpClose, target, transparent, active);
                    _drawWall(WallDir.DiagDownClose, target, transparent, active);
                    break;

                case WallDir.DiagUpDownClose2: // Done
                    _drawWall(WallDir.DiagUpClose2, target, transparent, active);
                    _drawWall(WallDir.DiagDownClose2, target, transparent, active);
                    break;

                case WallDir.DiagLeftRightClose: // Done
                    _drawWall(WallDir.DiagRightClose, target, transparent, active);
                    _drawWall(WallDir.DiagLeftClose, target, transparent, active);
                    break;

                case WallDir.DiagLeftRightClose2: // Done
                    _drawWall(WallDir.DiagRightClose2, target, transparent, active);
                    _drawWall(WallDir.DiagLeftClose2, target, transparent, active);
                    break;

                case WallDir.None:
                    break;

                default:
                    Color color = active ? Color.Red : Color.White;
                    if ((dir == WallDir.UpLeftDiag) && (special != Backend.WallType.Normal))
                    {

                        // 32 PIXEL LINKS
                        // 32 PIXEL RECHTS
                        _spriteBatch.Draw(_walls[(int)dir].animationTexture, new Rectangle(
                            target.Left + _walls[(int)dir].offsetX,
                            target.Top + _walls[(int)dir].offsetY,
                            target.Width - _walls[(int)dir].offsetX - _walls[(int)dir].cropX - 96,
                            target.Height - _walls[(int)dir].offsetY - _walls[(int)dir].cropY),
                            new Rectangle(_walls[(int)dir].animationRect.Left, _walls[(int)dir].animationRect.Top, _walls[(int)dir].animationRect.Width - 96, _walls[(int)dir].animationRect.Height), transparent ? new Color(color, (float)0.5) : color);
                        _spriteBatch.Draw(_walls[(int)dir].animationTexture, new Rectangle(
            target.Left + _walls[(int)dir].offsetX + 96,
            target.Top + _walls[(int)dir].offsetY,
            target.Width - _walls[(int)dir].offsetX - _walls[(int)dir].cropX - 96,
            target.Height - _walls[(int)dir].offsetY - _walls[(int)dir].cropY),
            new Rectangle(_walls[(int)dir].animationRect.Left, _walls[(int)dir].animationRect.Top, _walls[(int)dir].animationRect.Width - 96, _walls[(int)dir].animationRect.Height), transparent ? new Color(color, (float)0.5) : color);

                    }

                    _spriteBatch.Draw(_walls[(int)dir + (int)special * 100].animationTexture, new Rectangle(
                        target.Left + _walls[(int)dir + (int)special * 100].offsetX,
                        target.Top + _walls[(int)dir + (int)special * 100].offsetY,
                        target.Width - _walls[(int)dir + (int)special * 100].offsetX - _walls[(int)dir + (int)special * 100].cropX,
                        target.Height - _walls[(int)dir + (int)special * 100].offsetY - _walls[(int)dir + (int)special * 100].cropY),
                        _walls[(int)dir + (int)special * 100].animationRect, transparent ? new Color(color, (float)0.5) : color);
                    break;

            }
        }