TEditXna.ViewModel.WorldViewModel.SetPixelAutomatic C# (CSharp) Method

SetPixelAutomatic() private method

private SetPixelAutomatic ( Tile curTile, int tile = null, int wall = null, byte liquid = null, LiquidType liquidType = null, bool wire = null, short u = null, short v = null, bool wire2 = null, bool wire3 = null, bool wire4 = null, BrickStyle brickStyle = null, bool actuator = null, bool actuatorInActive = null, int tileColor = null, int wallColor = null ) : void
curTile Tile
tile int
wall int
liquid byte
liquidType LiquidType
wire bool
u short
v short
wire2 bool
wire3 bool
wire4 bool
brickStyle BrickStyle
actuator bool
actuatorInActive bool
tileColor int
wallColor int
return void
        private void SetPixelAutomatic(Tile curTile,
            int? tile = null,
            int? wall = null,
            byte? liquid = null,
            LiquidType? liquidType = null,
            bool? wire = null,
            short? u = null,
            short? v = null,
            bool? wire2 = null,
            bool? wire3 = null,
            bool? wire4 = null,
            BrickStyle? brickStyle = null,
            bool? actuator = null, bool? actuatorInActive = null,
            int? tileColor = null,
            int? wallColor = null)
        {
            // Set Tile Data
            if (u != null)
                curTile.U = (short)u;
            if (v != null)
                curTile.V = (short)v;

            if (tile != null)
            {
                if (tile == -1)
                {
                    curTile.Type = 0;
                    curTile.IsActive = false;
                    curTile.InActive = false;
                    curTile.Actuator = false;
                    curTile.BrickStyle = BrickStyle.Full;
                    curTile.U = 0;
                    curTile.V = 0;
                }
                else
                {
                    curTile.Type = (ushort)tile;
                    curTile.IsActive = true;
                    if (World.TileProperties[curTile.Type].IsSolid)
                    {
                        curTile.U = -1;
                        curTile.V = -1;
                    }
                }
            }

            if (actuator != null && curTile.IsActive)
            {
                curTile.Actuator = (bool)actuator;
            }

            if (actuatorInActive != null && curTile.IsActive)
            {
                curTile.InActive = (bool)actuatorInActive;
            }

            if (brickStyle != null && TilePicker.BrickStyleActive)
            {
                curTile.BrickStyle = (BrickStyle)brickStyle;
            }

            if (wall != null)
                curTile.Wall = (byte)wall;

            if (liquid != null)
            {
                curTile.LiquidAmount = (byte)liquid;
            }

            if (liquidType != null)
            {
                curTile.LiquidType = (LiquidType)liquidType;
            }

            if (wire != null)
                curTile.WireRed = (bool)wire;

            if (wire2 != null)
                curTile.WireBlue = (bool)wire2;

            if (wire3 != null)
                curTile.WireGreen = (bool)wire3;

            if (wire4 != null)
                curTile.WireYellow = (bool)wire4;

            if (tileColor != null)
            {
                if (curTile.IsActive)
                {
                    curTile.TileColor = (byte)tileColor;
                }
                else
                {
                    curTile.TileColor = (byte)0;
                }
            }

            if (wallColor != null)
            {
                if (curTile.Wall != 0)
                {
                    curTile.WallColor = (byte)wallColor;
                }
                else
                {
                    curTile.WallColor = (byte)0;
                }
            }

            if (curTile.IsActive)
                if (World.TileProperties[curTile.Type].IsSolid && !curTile.InActive && !World.TileProperties[curTile.Type].IsPlatform)
                    curTile.LiquidAmount = 0;
        }