Exemplo n.º 1
0
        public static Color GetTileColor(Tile tile, Color background, bool showWall = true, bool showTile = true, bool showLiquid = true, bool showWire = true)
        {
            var c = new Color(0, 0, 0, 0);

            if (tile.Wall > 0 && showWall)
                if (World.WallProperties.Count > tile.Wall)
                    c = c.AlphaBlend(World.WallProperties[tile.Wall].Color);
                else
                    c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors
            else
                c = background;

            if (tile.IsActive && showTile)
            {
                if (World.TileProperties.Count > tile.Type)
                    c = c.AlphaBlend(World.TileProperties[tile.Type].Color);
                else
                    c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors
            }

            if (tile.Liquid > 0 && showLiquid)
                c = c.AlphaBlend(tile.IsLava ? World.GlobalColors["Lava"] : World.GlobalColors["Water"]);

            if (tile.HasWire && showWire)
                c = c.AlphaBlend(World.GlobalColors["Wire"]);

            return c;
        }
Exemplo n.º 2
0
        public static Color GetTileColor(Tile tile, Color background, bool showWall = true, bool showTile = true, bool showLiquid = true, bool showRedWire = true, bool showBlueWire = true, bool showGreenWire = true, bool showYellowWire = true)
        {
            var c = new Color(0, 0, 0, 0);

            if (tile.Wall > 0 && showWall)
            {
                if (tile.WallColor > 0 && (!showTile || tile.TileColor == 0))
                    c = c.AlphaBlend(World.PaintProperties[tile.WallColor].Color);
                else if (World.WallProperties.Count > tile.Wall)
                {
                    if (World.WallProperties[tile.Wall].Color.A != 0)
                        c = c.AlphaBlend(World.WallProperties[tile.Wall].Color);
                    else
                        c = background;
                }
                else
                    c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors
            }
            else
                c = background;

            if (tile.IsActive && showTile)
            {
                if (tile.TileColor > 0)
                    c = c.AlphaBlend(World.PaintProperties[tile.TileColor].Color);
                else if (World.TileProperties.Count > tile.Type)
                    c = c.AlphaBlend(World.TileProperties[tile.Type].Color);
                else
                    c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors
            }

            if (tile.LiquidAmount > 0 && showLiquid)
            {
                if (tile.LiquidType == LiquidType.Lava) c = c.AlphaBlend(World.GlobalColors["Lava"]);
                else if (tile.LiquidType == LiquidType.Honey) c = c.AlphaBlend(World.GlobalColors["Honey"]);
                else c = c.AlphaBlend(World.GlobalColors["Water"]);
            }

            if (tile.WireRed && showRedWire)
            {
                c = c.AlphaBlend(World.GlobalColors["Wire"]);
            }
            if (tile.WireGreen && showGreenWire)
            {
                c = c.AlphaBlend(World.GlobalColors["Wire2"]);
            }
            if (tile.WireBlue && showBlueWire)
            {
                c = c.AlphaBlend(World.GlobalColors["Wire1"]);
            }
            if (tile.WireYellow && showYellowWire)
            {
                c = c.AlphaBlend(World.GlobalColors["Wire3"]);
            }

            return c;
        }