示例#1
0
        public virtual void ReadColors()
        {
            // Loop through each color and find the unique ones
            for (var i = 0; i < totalPixels; i++)
            {
                //PosUtil.CalculatePosition(i, width, out x, out y);
                x = i % width;
                y = i / width;

                // Get the current color
                tmpColor = tex.GetPixel(x, y); //pixels[i]);

                if (tmpColor.a < 1)            // && !ignoreTransparent)
                {
                    tmpColor = magenta;
                }

                // Look to see if the color is already in the list
                if (!colors.Contains(tmpColor) && unique)
                {
                    colors.Add(tmpColor);
                }
                else if (unique == false)
                {
                    colors.Add(tmpColor);
                }
            }

            totalColors = colors.Count;

            currentStep++;
        }
示例#2
0
        public override void CutOutSpriteFromTexture2D()
        {
            base.CutOutSpriteFromTexture2D();

            // Calculate flag value
            var color = tileFlagTex != null?tileFlagTex.GetPixel(x, y) : clear;

            if (Equals(color, maskColor))
            {
                color = clear;
            }

            flag = color.a < 1 ? -1 : flagColorChip.FindColorID(ColorData.ColorToHex(color.r, color.g, color.b));// == 1 ? (int) (color.r * 256) / tilemapChip.totalFlags : -1));
        }