/** * Blend color in texture */ public static void BlendTextureColor(Texture2D texture, Color color, CocoColorBlend.BlendAlgorithm blendFunc, float mixingFactor = 1) { Color[] texColors = texture.GetPixels(); Color tempColor; for (int i = 0; i < texColors.Length; i++) { tempColor = blendFunc(texColors [i], color); tempColor.r *= mixingFactor; tempColor.g *= mixingFactor; tempColor.b *= mixingFactor; texColors [i] = tempColor; } texture.SetPixels(texColors); }
/** * Blend color(hsl) in texture */ public static void BlendTextureColorHSL(Texture2D texture, Vector3 hsl, CocoColorBlend.BlendAlgorithm blendFunc, float mixingFactor = 1) { BlendTextureColor(texture, CocoColorConvert.Hsl2Rgb(hsl), blendFunc, mixingFactor); }