static int _m_GetVector(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.ParticleSystem.CustomDataModule __cl_gen_to_be_invoked; translator.Get(L, 1, out __cl_gen_to_be_invoked); try { { UnityEngine.ParticleSystemCustomData stream; translator.Get(L, 2, out stream); int component = LuaAPI.xlua_tointeger(L, 3); UnityEngine.ParticleSystem.MinMaxCurve __cl_gen_ret = __cl_gen_to_be_invoked.GetVector(stream, component); translator.Push(L, __cl_gen_ret); translator.Update(L, 1, __cl_gen_to_be_invoked); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
private MinMaxCurve GetMinMaxCurveFromMMC(UnityEngine.ParticleSystem.MinMaxCurve mmc, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { MinMaxCurve minMaxCurve = new MinMaxCurve(); minMaxCurve.mode = (int)mmc.mode; if (mmc.mode == ParticleSystemCurveMode.Constant) { minMaxCurve.constantMax = mmc.constant; } else if (mmc.mode == ParticleSystemCurveMode.TwoConstants) { minMaxCurve.constantMax = mmc.constantMax; minMaxCurve.constantMin = mmc.constantMin; } else if (mmc.mode == ParticleSystemCurveMode.Curve) { minMaxCurve.curveMax = GetCurveEntityFromAnimationCurve(mmc.curve, mmc.curveMultiplier, dstManager, conversionSystem); } else if (mmc.mode == ParticleSystemCurveMode.TwoCurves) { minMaxCurve.curveMax = GetCurveEntityFromAnimationCurve(mmc.curveMax, mmc.curveMultiplier, dstManager, conversionSystem); minMaxCurve.curveMin = GetCurveEntityFromAnimationCurve(mmc.curveMin, mmc.curveMultiplier, dstManager, conversionSystem); } return(minMaxCurve); }
static int __CreateInstance(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { if (LuaAPI.lua_gettop(L) == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) { float constant = (float)LuaAPI.lua_tonumber(L, 2); UnityEngine.ParticleSystem.MinMaxCurve __cl_gen_ret = new UnityEngine.ParticleSystem.MinMaxCurve(constant); translator.Push(L, __cl_gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <UnityEngine.AnimationCurve>(L, 3)) { float multiplier = (float)LuaAPI.lua_tonumber(L, 2); UnityEngine.AnimationCurve curve = (UnityEngine.AnimationCurve)translator.GetObject(L, 3, typeof(UnityEngine.AnimationCurve)); UnityEngine.ParticleSystem.MinMaxCurve __cl_gen_ret = new UnityEngine.ParticleSystem.MinMaxCurve(multiplier, curve); translator.Push(L, __cl_gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <UnityEngine.AnimationCurve>(L, 3) && translator.Assignable <UnityEngine.AnimationCurve>(L, 4)) { float multiplier = (float)LuaAPI.lua_tonumber(L, 2); UnityEngine.AnimationCurve min = (UnityEngine.AnimationCurve)translator.GetObject(L, 3, typeof(UnityEngine.AnimationCurve)); UnityEngine.AnimationCurve max = (UnityEngine.AnimationCurve)translator.GetObject(L, 4, typeof(UnityEngine.AnimationCurve)); UnityEngine.ParticleSystem.MinMaxCurve __cl_gen_ret = new UnityEngine.ParticleSystem.MinMaxCurve(multiplier, min, max); translator.Push(L, __cl_gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { float min = (float)LuaAPI.lua_tonumber(L, 2); float max = (float)LuaAPI.lua_tonumber(L, 3); UnityEngine.ParticleSystem.MinMaxCurve __cl_gen_ret = new UnityEngine.ParticleSystem.MinMaxCurve(min, max); translator.Push(L, __cl_gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 1) { translator.Push(L, default(UnityEngine.ParticleSystem.MinMaxCurve)); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.ParticleSystem.MinMaxCurve constructor!")); }
/// <summary> /// Write the specified value using the writer. /// </summary> /// <param name="value">Value.</param> /// <param name="writer">Writer.</param> public override void Write(object value, ISaveGameWriter writer) { UnityEngine.ParticleSystem.MinMaxCurve minMaxCurve = (UnityEngine.ParticleSystem.MinMaxCurve)value; writer.WriteProperty("mode", minMaxCurve.mode); writer.WriteProperty("curveMultiplier", minMaxCurve.curveMultiplier); writer.WriteProperty("curveMax", minMaxCurve.curveMax); writer.WriteProperty("curveMin", minMaxCurve.curveMin); writer.WriteProperty("constantMax", minMaxCurve.constantMax); writer.WriteProperty("constantMin", minMaxCurve.constantMin); writer.WriteProperty("constant", minMaxCurve.constant); writer.WriteProperty("curve", minMaxCurve.curve); }
protected override void GetDependencies(System.Collections.Generic.Dictionary <long, UnityEngine.Object> dependencies, object obj) { base.GetDependencies(dependencies, obj); if (obj == null) { return; } UnityEngine.ParticleSystem.MinMaxCurve o = (UnityEngine.ParticleSystem.MinMaxCurve)obj; GetDependencies(curveMax, o.curveMax, dependencies); GetDependencies(curveMin, o.curveMin, dependencies); GetDependencies(curve, o.curve, dependencies); }
static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject *ptr_of_this_method, IList <object> __mStack, ref UnityEngine.ParticleSystem.MinMaxCurve instance_of_this_method) { ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); switch (ptr_of_this_method->ObjectType) { case ObjectTypes.Object: { __mStack[ptr_of_this_method->Value] = instance_of_this_method; } break; case ObjectTypes.FieldReference: { var ___obj = __mStack[ptr_of_this_method->Value]; if (___obj is ILTypeInstance) { ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method; } else { var t = __domain.GetType(___obj.GetType()) as CLRType; t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method); } } break; case ObjectTypes.StaticFieldReference: { var t = __domain.GetType(ptr_of_this_method->Value); if (t is ILType) { ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method; } else { ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method); } } break; case ObjectTypes.ArrayReference: { var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.ParticleSystem.MinMaxCurve[]; instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method; } break; } }
public override object Read <T>(ES3Reader reader) { var instance = new UnityEngine.ParticleSystem.MinMaxCurve(); string propertyName; while ((propertyName = reader.ReadPropertyName()) != null) { switch (propertyName) { case "mode": instance.mode = reader.Read <UnityEngine.ParticleSystemCurveMode>(); break; case "curveMultiplier": instance.curveMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "curveMax": instance.curveMax = reader.Read <UnityEngine.AnimationCurve>(ES3Type_AnimationCurve.Instance); break; case "curveMin": instance.curveMin = reader.Read <UnityEngine.AnimationCurve>(ES3Type_AnimationCurve.Instance); break; case "constantMax": instance.constantMax = reader.Read <System.Single>(ES3Type_float.Instance); break; case "constantMin": instance.constantMin = reader.Read <System.Single>(ES3Type_float.Instance); break; case "constant": instance.constant = reader.Read <System.Single>(ES3Type_float.Instance); break; case "curve": instance.curve = reader.Read <UnityEngine.AnimationCurve>(ES3Type_AnimationCurve.Instance); break; default: reader.Skip(); break; } } return(instance); }
private float GetValueFromMMC(UnityEngine.ParticleSystem.MinMaxCurve mmc, bool toDegrees = false) { float value = 1f; if (mmc.mode == ParticleSystemCurveMode.Constant) { value = toDegrees ? math.degrees(mmc.constant) : mmc.constant; } else if (mmc.mode == ParticleSystemCurveMode.TwoConstants) { var min = toDegrees ? math.degrees(mmc.constantMin) : mmc.constantMin; var max = toDegrees ? math.degrees(mmc.constantMax) : mmc.constantMax; value = m_rand.NextFloat(min, max); } return(value); }
public override void ReadFrom(object obj) { base.ReadFrom(obj); if (obj == null) { return; } UnityEngine.ParticleSystem.MinMaxCurve o = (UnityEngine.ParticleSystem.MinMaxCurve)obj; mode = (uint)o.mode; curveMultiplier = o.curveMultiplier; curveMax = Read(curveMax, o.curveMax); curveMin = Read(curveMin, o.curveMin); constantMax = o.constantMax; constantMin = o.constantMin; constant = o.constant; curve = Read(curve, o.curve); }
public override object WriteTo(object obj, System.Collections.Generic.Dictionary <long, UnityEngine.Object> objects) { obj = base.WriteTo(obj, objects); if (obj == null) { return(null); } UnityEngine.ParticleSystem.MinMaxCurve o = (UnityEngine.ParticleSystem.MinMaxCurve)obj; o.mode = (UnityEngine.ParticleSystemCurveMode)mode; o.curveMultiplier = curveMultiplier; o.curveMax = Write(o.curveMax, curveMax, objects); o.curveMin = Write(o.curveMin, curveMin, objects); o.constantMax = constantMax; o.constantMin = constantMin; o.constant = constant; o.curve = Write(o.curve, curve, objects); return(o); }
/// <summary> /// Read the data using the reader. /// </summary> /// <param name="reader">Reader.</param> public override object Read(ISaveGameReader reader) { UnityEngine.ParticleSystem.MinMaxCurve minMaxCurve = new UnityEngine.ParticleSystem.MinMaxCurve(); foreach (string property in reader.Properties) { switch (property) { case "mode": minMaxCurve.mode = reader.ReadProperty <UnityEngine.ParticleSystemCurveMode> (); break; case "curveMultiplier": minMaxCurve.curveMultiplier = reader.ReadProperty <System.Single> (); break; case "curveMax": minMaxCurve.curveMax = reader.ReadProperty <UnityEngine.AnimationCurve> (); break; case "curveMin": minMaxCurve.curveMin = reader.ReadProperty <UnityEngine.AnimationCurve> (); break; case "constantMax": minMaxCurve.constantMax = reader.ReadProperty <System.Single> (); break; case "constantMin": minMaxCurve.constantMin = reader.ReadProperty <System.Single> (); break; case "constant": minMaxCurve.constant = reader.ReadProperty <System.Single> (); break; case "curve": minMaxCurve.curve = reader.ReadProperty <UnityEngine.AnimationCurve> (); break; } } return(minMaxCurve); }
static StackObject *set_startRotation_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.ParticleSystem.MinMaxCurve @value = (UnityEngine.ParticleSystem.MinMaxCurve) typeof(UnityEngine.ParticleSystem.MinMaxCurve).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); UnityEngine.ParticleSystem.MainModule instance_of_this_method = (UnityEngine.ParticleSystem.MainModule) typeof(UnityEngine.ParticleSystem.MainModule).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); instance_of_this_method.startRotation = value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); __intp.Free(ptr_of_this_method); return(__ret); }
public void DeserializeBeforeRef(UABUnpacker unpacker, UABField field, ref object value, List <ISerializer> serializers) { var data = new Data(); unpacker.Deserialize(data, field.fields, serializers); value = new UnityEngine.ParticleSystem.MinMaxCurve() { mode = data.mode, #if UNITY_5_5_OR_NEWER constant = data.constant, #endif constantMin = data.constantMin, constantMax = data.constantMax, #if UNITY_5_5_OR_NEWER curve = data.curve, #endif curveMin = data.curveMin, curveMax = data.curveMax, #if UNITY_5_5_OR_NEWER curveMultiplier = data.curveMultiplier, #endif }; }
private Range GetRangeFromMMC(UnityEngine.ParticleSystem.MinMaxCurve mmc, bool toDegrees = false) { var minValue = 2f; var maxValue = 2f; if (mmc.mode == ParticleSystemCurveMode.Constant) { var value = toDegrees ? math.degrees(mmc.constant) : mmc.constant; minValue = value; maxValue = value; } else if (mmc.mode == ParticleSystemCurveMode.TwoConstants) { var min = toDegrees ? math.degrees(mmc.constantMin) : mmc.constantMin; var max = toDegrees ? math.degrees(mmc.constantMax) : mmc.constantMax; minValue = min; maxValue = max; } return(new Range { start = minValue, end = maxValue }); }
// TODO support curves private static Range ConvertMinMaxCurve(UnityEngine.ParticleSystem.MinMaxCurve curve) { switch (curve.mode) { case ParticleSystemCurveMode.Constant: return(new Range { Start = curve.constant, End = curve.constant }); case ParticleSystemCurveMode.TwoConstants: return(new Range { Start = curve.constantMin, End = curve.constantMax }); case ParticleSystemCurveMode.Curve: case ParticleSystemCurveMode.TwoCurves: UnityEngine.Debug.LogWarning("ParticleSystemCurveMode " + nameof(curve.mode) + " not supported."); return(new Range()); default: throw new System.ArgumentOutOfRangeException(nameof(curve.mode), curve.mode, null); } }
private Entity GetCurve3FromMMC(UnityEngine.ParticleSystem.MinMaxCurve mmcX, UnityEngine.ParticleSystem.MinMaxCurve mmcY, UnityEngine.ParticleSystem.MinMaxCurve mmcZ, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var curveEntity = conversionSystem.CreateAdditionalEntity(this); var keysEntity = conversionSystem.CreateAdditionalEntity(this); if (mmcX.mode == ParticleSystemCurveMode.Constant) { var curve = new StepCurveFloat3 { keys = keysEntity }; dstManager.AddComponentData <StepCurveFloat3>(curveEntity, curve); var buffer = dstManager.AddBuffer <KeyFloat3>(keysEntity); var value = new float3(mmcX.constant, mmcY.constant, mmcZ.constant); buffer.Add(new KeyFloat3(0f, value)); buffer.Add(new KeyFloat3(1f, value)); } else if (mmcX.mode == ParticleSystemCurveMode.TwoConstants) { var curve = new LinearCurveFloat3 { keys = keysEntity }; dstManager.AddComponentData <LinearCurveFloat3>(curveEntity, curve); var buffer = dstManager.AddBuffer <KeyFloat3>(keysEntity); var min = new float3(mmcX.constantMin, mmcY.constantMin, mmcZ.constantMin); buffer.Add(new KeyFloat3(0f, min)); var max = new float3(mmcX.constantMax, mmcY.constantMax, mmcZ.constantMax); buffer.Add(new KeyFloat3(1f, max)); } else if (mmcX.mode == ParticleSystemCurveMode.Curve) { var curve = new BezierCurveFloat3 { keys = keysEntity }; dstManager.AddComponentData <BezierCurveFloat3>(curveEntity, curve); var buffer = dstManager.AddBuffer <BezierKeyFloat3>(keysEntity); var keyFrames = mmcX.curve.keys; var multiplier = mmcX.curveMultiplier; for (int i = 0; i < keyFrames.Length; i++) { var keyFrame = keyFrames[i]; var time = keyFrame.time; var value = new float3(keyFrame.value, mmcY.curve.Evaluate(time), mmcZ.curve.Evaluate(time)) * multiplier; var inValue = value - keyFrame.inTangent * 0.15f; var outValue = value + keyFrame.outTangent * 0.15f; buffer.Add(new BezierKeyFloat3(time, value, inValue, outValue)); } } else if (mmcX.mode == ParticleSystemCurveMode.TwoCurves) { var curve = new BezierCurveFloat3 { keys = keysEntity }; dstManager.AddComponentData <BezierCurveFloat3>(curveEntity, curve); var buffer = dstManager.AddBuffer <BezierKeyFloat3>(keysEntity); var keyFrames = mmcX.curveMax.keys; var multiplier = mmcX.curveMultiplier; for (int i = 0; i < keyFrames.Length; i++) { var keyFrame = keyFrames[i]; var time = keyFrame.time; var value = new float3(keyFrame.value, mmcY.curveMax.Evaluate(time), mmcZ.curveMax.Evaluate(time)) * multiplier; var inValue = value - keyFrame.inTangent * 0.15f; var outValue = value + keyFrame.outTangent * 0.15f; buffer.Add(new BezierKeyFloat3(time, value, inValue, outValue)); } } return(curveEntity); }
private Entity GetCurveFromMMC(UnityEngine.ParticleSystem.MinMaxCurve mmc, EntityManager dstManager, Entity curveEntity, Entity keysEntity, bool toDegrees = false) { //var curveEntity = dstManager.CreateEntity(); //var keysEntity = dstManager.CreateEntity(); //UnityEngine.Debug.Log("ParticleSystemConversionSystem: curveEntity = " + curveEntity); if (mmc.mode == ParticleSystemCurveMode.Constant) { var curve = new StepCurveFloat { keys = keysEntity }; dstManager.AddComponentData <StepCurveFloat>(curveEntity, curve); var buffer = dstManager.AddBuffer <KeyFloat>(keysEntity); var value = toDegrees ? math.degrees(mmc.constant) : mmc.constant; buffer.Add(new KeyFloat(0f, value)); buffer.Add(new KeyFloat(1f, value)); } else if (mmc.mode == ParticleSystemCurveMode.TwoConstants) { var curve = new LinearCurveFloat { keys = keysEntity }; dstManager.AddComponentData <LinearCurveFloat>(curveEntity, curve); var buffer = dstManager.AddBuffer <KeyFloat>(keysEntity); var min = toDegrees ? math.degrees(mmc.constantMin) : mmc.constantMin; var max = toDegrees ? math.degrees(mmc.constantMax) : mmc.constantMax; buffer.Add(new KeyFloat(0f, min)); buffer.Add(new KeyFloat(1f, max)); } else if (mmc.mode == ParticleSystemCurveMode.Curve) { var curve = new BezierCurveFloat { keys = keysEntity }; dstManager.AddComponentData <BezierCurveFloat>(curveEntity, curve); var buffer = dstManager.AddBuffer <BezierKeyFloat>(keysEntity); var keyFrames = mmc.curve.keys; var multiplier = mmc.curveMultiplier; for (int i = 0; i < keyFrames.Length; i++) { var keyFrame = keyFrames[i]; var value = toDegrees ? math.degrees(keyFrame.value) : keyFrame.value; value *= multiplier; var inValue = value - keyFrame.inTangent * 0.15f; var outValue = value + keyFrame.outTangent * 0.15f; buffer.Add(new BezierKeyFloat(keyFrame.time, value, inValue, outValue)); } } else if (mmc.mode == ParticleSystemCurveMode.TwoCurves) { var curve = new BezierCurveFloat { keys = keysEntity }; dstManager.AddComponentData <BezierCurveFloat>(curveEntity, curve); var buffer = dstManager.AddBuffer <BezierKeyFloat>(keysEntity); var mmcCurve = mmc.curveMin; if (mmcCurve.length < mmc.curveMax.length) { mmcCurve = mmc.curveMax; } var keyFrames = mmcCurve.keys; var multiplier = mmc.curveMultiplier; for (int i = 0; i < keyFrames.Length; i++) { var keyFrame = keyFrames[i]; var value = toDegrees ? math.degrees(keyFrame.value) : keyFrame.value; value *= multiplier; var inValue = value - keyFrame.inTangent * 0.15f; var outValue = value + keyFrame.outTangent * 0.15f; buffer.Add(new BezierKeyFloat(keyFrame.time, value, inValue, outValue)); } } return(curveEntity); }