static int Evaluate(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { UnityEngine.ParticleSystem.MinMaxGradient obj = (UnityEngine.ParticleSystem.MinMaxGradient)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem.MinMaxGradient)); float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Color o = obj.Evaluate(arg0); ToLua.Push(L, o); ToLua.SetBack(L, 1, obj); return(1); } else if (count == 3) { UnityEngine.ParticleSystem.MinMaxGradient obj = (UnityEngine.ParticleSystem.MinMaxGradient)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem.MinMaxGradient)); float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); UnityEngine.Color o = obj.Evaluate(arg0, arg1); ToLua.Push(L, o); ToLua.SetBack(L, 1, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.MinMaxGradient.Evaluate")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private static UnityEngine.ParticleSystem.MinMaxGradient MergeColorAndAlpha(UnityEngine.ParticleSystem.MinMaxGradient startColor, UnityEngine.ParticleSystem.MinMaxCurve alpha) { UnityEngine.ParticleSystem.MinMaxGradient ret = startColor; if (startColor.mode == ParticleSystemGradientMode.Color && alpha.mode == ParticleSystemCurveMode.Constant) { ret = new UnityEngine.ParticleSystem.MinMaxGradient(new Color(startColor.color.r, startColor.color.g, startColor.color.b, alpha.constant)); } else if (startColor.mode == ParticleSystemGradientMode.Color && alpha.mode == ParticleSystemCurveMode.Curve) { var alphaKeys = new GradientAlphaKey[alpha.curve.length]; var colorKeys = new GradientColorKey[2]; colorKeys[0].time = 0.0f; colorKeys[1].time = 1.0f; colorKeys[0].color = startColor.color; colorKeys[1].color = startColor.color; for (int i = 0; i < alphaKeys.Length; ++i) { alphaKeys[i].time = alpha.curve.keys[i].time; alphaKeys[i].alpha = alpha.curve.keys[i].value; } var gradient = new Gradient(); gradient.alphaKeys = alphaKeys; gradient.colorKeys = colorKeys; ret = new UnityEngine.ParticleSystem.MinMaxGradient(gradient); } else if (startColor.mode == ParticleSystemGradientMode.Gradient && alpha.mode == ParticleSystemCurveMode.Constant) { var alphaKeys = startColor.gradient.alphaKeys; for (int i = 0; i < alphaKeys.Length; ++i) { alphaKeys[i].alpha = alpha.constant; } var gradient = new Gradient(); gradient.alphaKeys = alphaKeys; gradient.colorKeys = startColor.gradient.colorKeys; ret = new UnityEngine.ParticleSystem.MinMaxGradient(gradient); } else if (startColor.mode == ParticleSystemGradientMode.Gradient && alpha.mode == ParticleSystemCurveMode.Curve) { var alphaKeys = new GradientAlphaKey[alpha.curve.length]; for (int i = 0; i < alphaKeys.Length; ++i) { alphaKeys[i].time = alpha.curve.keys[i].time; alphaKeys[i].alpha = alpha.curve.keys[i].value; } var gradient = new Gradient(); gradient.alphaKeys = alphaKeys; gradient.colorKeys = startColor.gradient.colorKeys; ret = new UnityEngine.ParticleSystem.MinMaxGradient(gradient); } else if (startColor.mode == ParticleSystemGradientMode.Color && alpha.mode == ParticleSystemCurveMode.TwoConstants) { Color origionColor = startColor.Evaluate(0.0f); Color min = new Color(origionColor.r, origionColor.g, origionColor.b, alpha.constantMin); Color max = new Color(origionColor.r, origionColor.g, origionColor.b, alpha.constantMax); ret = new UnityEngine.ParticleSystem.MinMaxGradient(min, max); } else if (startColor.mode == ParticleSystemGradientMode.TwoGradients && alpha.mode == ParticleSystemCurveMode.Constant) { var tmpmin = startColor.gradientMin; var alphaKeys = tmpmin.alphaKeys; for (int i = 0; i < alphaKeys.Length; ++i) { alphaKeys[i].alpha = alpha.constant; } var min = new Gradient(); min.alphaKeys = alphaKeys; min.colorKeys = tmpmin.colorKeys; var tmpmax = startColor.gradientMax; alphaKeys = tmpmax.alphaKeys; for (int i = 0; i < alphaKeys.Length; ++i) { alphaKeys[i].alpha = alpha.constant; } var max = new Gradient(); max.alphaKeys = alphaKeys; max.colorKeys = tmpmax.colorKeys; ret = new UnityEngine.ParticleSystem.MinMaxGradient(min, max); } else { Debug.LogFormat("ParticleSystemGradientMode:{0},ParticleSystemCurveMode:{1}\t颜色和Alpha通道的合并未实现", startColor.mode, alpha.mode); } return(ret); }