Good afternoon all, I am looking to create a method to add two Color Arrays together.
I wish to have something like this:
for(int y=aRootObject.layers[aLayer].height-1; y>=0; y--)
{
for(int x=0; x<aRootObject.layers[aLayer].width; x++)
{
Color[] aBaseTexturePixels = texture.GetPixels(x*aRootObject.tilewidth, y*aRootObject.tileheight, aRootObject.tilewidth, aRootObject.tileheight);
Color[] aCopyTexturePixels = (aRootObject.layers[aLayer].data[g])-1 > 0 ? tiles[ (aRootObject.layers[aLayer].data[g])-1] : aBaseTexturePixels;
Color[] aColorList = new Color[aBaseTexturePixels.Length];
int aPixelLength = aBaseTexturePixels.Length;
for(int p = 0; p < aPixelLength; p++)
{
aColorList[p] = Color.Lerp(aBaseTexturePixels[p], aCopyTexturePixels[p], aCopyTexturePixels[p].a);
}
//p = p + texture.GetPixels(x*aRootObject.tilewidth, y*aRootObject.tileheight, aRootObject.tilewidth, aRootObject.tileheight);
texture.SetPixels(x*aRootObject.tilewidth, y*aRootObject.tileheight, aRootObject.tilewidth, aRootObject.tileheight, aColorList);
g++;
}
}
Unfortunately this method does not yield the result that I wish, go figure.
PS: If it wasn’t clear in the code, my goal is to add what is already on the texture with my new information.