コード例 #1
0
ファイル: GameTexture.cs プロジェクト: fiabot/HiddenLayers
    /// <summary>
    /// GameTexture from existing Texture 2D
    /// </summary>
    /// <param name="orginalTexture"></param> starting Texture 2D
    public GameTexture(Texture2D orginalTexture)
    {
        width  = orginalTexture.width;
        height = orginalTexture.height;

        totalColors = new GameColor[width, height];
        blackLayers = new int[width, height];
        tex         = new Texture2D(width, height);

        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                GameColor color = GameColor.getGameColorFromColor(orginalTexture.GetPixel(x, y));
                if (color.getColorName().Equals("black"))
                {
                    blackLayers[x, y] = 1;
                }
                else
                {
                    blackLayers[x, y] = 0;
                }

                totalColors[x, y] = color;
            }
        }
    }