public override void OnActivate(Ship ship) { base.OnActivate(ship); originalAcceleration = ship.attributes.acceleration; originalSpeed = ship.attributes.speed; foreach (ParticleSystem trail in ship.trails) { if (trail) { originalTrailColor = trail.main.startColor; originalEmissionRoT = trail.emission.rateOverTime; originalStartSpeed = trail.main.startSpeed; ParticleSystem.MainModule psmm = trail.main; psmm.startColor = turboTrailColor; psmm.startSpeed = originalStartSpeed.constant * speedModifier; ParticleSystem.EmissionModule psem = trail.emission; psem.rateOverTime = originalEmissionRoT.constant * 5f; } } if (charge > 0f) { ship.attributes.acceleration *= accelerationModifier; ship.attributes.speed *= speedModifier; ship.engineVolumeModifier *= accelerationModifier; AudioManager.Play(activationSound, ship.transform.position, 0.6f); } }
public void PlaySnowEffect(float intensity, float maxParticleSize, float ySpeed, float windFactor, float windAngle) { _snow.maxParticles = (int)(intensity * snowMaxParticles); _snow.startSize = maxParticleSize; var emission = _snow.emission; ParticleSystem.MinMaxCurve emcurve = new ParticleSystem.MinMaxCurve (); emcurve.constantMax = intensity * snowEmission; emission.rate = emcurve; Vector2 windDirs = new Vector2 (Mathf.Sin(Mathf.Deg2Rad * windAngle) * windFactor, Mathf.Cos(Mathf.Deg2Rad * windAngle) * windFactor); var vOL = _snow.velocityOverLifetime; ParticleSystem.MinMaxCurve mmcx = new ParticleSystem.MinMaxCurve (); mmcx.constantMin = -3; mmcx.constantMax = 3; mmcx.mode = ParticleSystemCurveMode.TwoConstants; ParticleSystem.MinMaxCurve mmcy = new ParticleSystem.MinMaxCurve (); mmcy.constantMin = -10; mmcy.constantMax = -2; mmcy.mode = ParticleSystemCurveMode.TwoConstants; vOL.x = mmcx; vOL.y = mmcy; _snow.Play (); }
static public int constructor(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); UnityEngine.ParticleSystem.MinMaxCurve o; if (argc == 2) { System.Single a1; checkType(l, 2, out a1); o = new UnityEngine.ParticleSystem.MinMaxCurve(a1); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(float), typeof(UnityEngine.AnimationCurve))) { System.Single a1; checkType(l, 2, out a1); UnityEngine.AnimationCurve a2; checkType(l, 3, out a2); o = new UnityEngine.ParticleSystem.MinMaxCurve(a1, a2); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 4) { System.Single a1; checkType(l, 2, out a1); UnityEngine.AnimationCurve a2; checkType(l, 3, out a2); UnityEngine.AnimationCurve a3; checkType(l, 4, out a3); o = new UnityEngine.ParticleSystem.MinMaxCurve(a1, a2, a3); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(float), typeof(float))) { System.Single a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); o = new UnityEngine.ParticleSystem.MinMaxCurve(a1, a2); pushValue(l, true); pushValue(l, o); return(2); } return(error(l, "New object failed.")); } catch (Exception e) { return(error(l, e)); } }
// reference: http://forum.unity3d.com/threads/what-is-the-unity-5-3-equivalent-of-the-old-particlesystem-emissionrate.373106/ void Update () { if(Input.GetKeyDown(KeyCode.Space)){ var rate = new ParticleSystem.MinMaxCurve(); rate.constantMax = 1500f; em.rate = rate; Invoke("ResetParticleRate", 1f); } }
public UnityEngine.ParticleSystem.MinMaxCurve getNegativeCurve(ValueTypeUtil.CurveType flag = ValueTypeUtil.CurveType.Normal, float scale = 1.0f) { UnityEngine.ParticleSystem.MinMaxCurve ret; if (flag == ValueTypeUtil.CurveType.Rotation) { ret = new UnityEngine.ParticleSystem.MinMaxCurve(maxCurveAnchorValue, ValueTypeUtil.GenerateAnimationCurve(anchors, true, UnityEngine.Mathf.PI / 180.0f * scale)); } else { ret = new UnityEngine.ParticleSystem.MinMaxCurve(maxCurveAnchorValue, ValueTypeUtil.GenerateAnimationCurve(anchors, true, scale)); } return(ret); }
public UnityEngine.ParticleSystem.MinMaxCurve getNegativeCurve(ValueTypeUtil.CurveType flag = ValueTypeUtil.CurveType.Normal, float scale = 1.0f) { UnityEngine.ParticleSystem.MinMaxCurve ret; if (flag == ValueTypeUtil.CurveType.Rotation) { ret = new UnityEngine.ParticleSystem.MinMaxCurve(-max * UnityEngine.Mathf.PI / 180.0f * scale, -min * UnityEngine.Mathf.PI / 180.0f * scale); } else { ret = new UnityEngine.ParticleSystem.MinMaxCurve(-max * scale, -min * scale); } return(ret); }
static public int ctor_s(IntPtr l) { try { UnityEngine.ParticleSystem.MinMaxCurve o; o = new UnityEngine.ParticleSystem.MinMaxCurve(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); UnityEngine.ParticleSystem.MinMaxCurve o; if(argc==2){ System.Single a1; checkType(l,2,out a1); o=new UnityEngine.ParticleSystem.MinMaxCurve(a1); pushValue(l,true); pushValue(l,o); return 2; } else if(matchType(l,argc,2,typeof(float),typeof(UnityEngine.AnimationCurve))){ System.Single a1; checkType(l,2,out a1); UnityEngine.AnimationCurve a2; checkType(l,3,out a2); o=new UnityEngine.ParticleSystem.MinMaxCurve(a1,a2); pushValue(l,true); pushValue(l,o); return 2; } else if(argc==4){ System.Single a1; checkType(l,2,out a1); UnityEngine.AnimationCurve a2; checkType(l,3,out a2); UnityEngine.AnimationCurve a3; checkType(l,4,out a3); o=new UnityEngine.ParticleSystem.MinMaxCurve(a1,a2,a3); pushValue(l,true); pushValue(l,o); return 2; } else if(matchType(l,argc,2,typeof(float),typeof(float))){ System.Single a1; checkType(l,2,out a1); System.Single a2; checkType(l,3,out a2); o=new UnityEngine.ParticleSystem.MinMaxCurve(a1,a2); pushValue(l,true); pushValue(l,o); return 2; } return error(l,"New object failed."); } catch(Exception e) { return error(l,e); } }
static public int op_Implicit_s(IntPtr l) { try { System.Single a1; checkType(l, 1, out a1); UnityEngine.ParticleSystem.MinMaxCurve ret = a1; pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int ctor__Single_s(IntPtr l) { try { UnityEngine.ParticleSystem.MinMaxCurve o; System.Single a1; checkType(l, 1, out a1); o = new UnityEngine.ParticleSystem.MinMaxCurve(a1); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
static void MinMaxCurve_constantMin(JSVCall vc) { if (vc.bGet) { UnityEngine.ParticleSystem.MinMaxCurve _this = (UnityEngine.ParticleSystem.MinMaxCurve)vc.csObj; var result = _this.constantMin; JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result)); } else { System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg); UnityEngine.ParticleSystem.MinMaxCurve _this = (UnityEngine.ParticleSystem.MinMaxCurve)vc.csObj; _this.constantMin = arg0; JSMgr.changeJSObj(vc.jsObjID, _this); } }
static void MinMaxCurve_curveMin(JSVCall vc) { if (vc.bGet) { UnityEngine.ParticleSystem.MinMaxCurve _this = (UnityEngine.ParticleSystem.MinMaxCurve)vc.csObj; var result = _this.curveMin; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); } else { UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)JSMgr.datax.getObject((int)JSApi.GetType.Arg); UnityEngine.ParticleSystem.MinMaxCurve _this = (UnityEngine.ParticleSystem.MinMaxCurve)vc.csObj; _this.curveMin = arg0; JSMgr.changeJSObj(vc.jsObjID, _this); } }
static void EmissionModule_rate(JSVCall vc) { if (vc.bGet) { UnityEngine.ParticleSystem.EmissionModule _this = (UnityEngine.ParticleSystem.EmissionModule)vc.csObj; var result = _this.rate; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); } else { UnityEngine.ParticleSystem.MinMaxCurve arg0 = (UnityEngine.ParticleSystem.MinMaxCurve)JSMgr.datax.getObject((int)JSApi.GetType.Arg); UnityEngine.ParticleSystem.EmissionModule _this = (UnityEngine.ParticleSystem.EmissionModule)vc.csObj; _this.rate = arg0; JSMgr.changeJSObj(vc.jsObjID, _this); } }
// Update is called once per frame void Update () { //Need a local variable of the EmissionModule since ParticleSystem.emissionRate is deprecated ParticleSystem.EmissionModule emissionModule=_jetpackParticleSystem.emission; //Do a rotation with player inputs /*_jetpackParticleSystem.transform.rotation = Quaternion.LookRotation( new Vector3(-_playerController.GetLeftAnalogHorizontal(), -_playerController.GetLeftAnalogVertical(), 0.0f));*/ //transform.LookAt(this.transform.position + new Vector3(-_playerController.GetLeftAnalogHorizontal(), -_playerController.GetLeftAnalogVertical())); //Modification of the particle emission rate with player inputs ParticleSystem.MinMaxCurve rate = new ParticleSystem.MinMaxCurve(); rate.constantMax = ((Mathf.Abs(_playerController.GetLeftAnalogHorizontal()) + Mathf.Abs(_playerController.GetLeftAnalogVertical()) / 1.0f) * maxEmissionRate); emissionModule.rate = rate; }
static void LimitVelocityOverLifetimeModule_limit(JSVCall vc) { if (vc.bGet) { UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule _this = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)vc.csObj; var result = _this.limit; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); } else { UnityEngine.ParticleSystem.MinMaxCurve arg0 = (UnityEngine.ParticleSystem.MinMaxCurve)JSMgr.datax.getObject((int)JSApi.GetType.Arg); UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule _this = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)vc.csObj; _this.limit = arg0; JSMgr.changeJSObj(vc.jsObjID, _this); } }
// fields // properties static void MinMaxCurve_mode(JSVCall vc) { if (vc.bGet) { UnityEngine.ParticleSystem.MinMaxCurve _this = (UnityEngine.ParticleSystem.MinMaxCurve)vc.csObj; var result = _this.mode; JSApi.setEnum((int)JSApi.SetType.Rval, (int)result); } else { UnityEngine.ParticleSystemCurveMode arg0 = (UnityEngine.ParticleSystemCurveMode)JSApi.getEnum((int)JSApi.GetType.Arg); UnityEngine.ParticleSystem.MinMaxCurve _this = (UnityEngine.ParticleSystem.MinMaxCurve)vc.csObj; _this.mode = arg0; JSMgr.changeJSObj(vc.jsObjID, _this); } }
static void TextureSheetAnimationModule_frameOverTime(JSVCall vc) { if (vc.bGet) { UnityEngine.ParticleSystem.TextureSheetAnimationModule _this = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)vc.csObj; var result = _this.frameOverTime; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); } else { UnityEngine.ParticleSystem.MinMaxCurve arg0 = (UnityEngine.ParticleSystem.MinMaxCurve)JSMgr.datax.getObject((int)JSApi.GetType.Arg); UnityEngine.ParticleSystem.TextureSheetAnimationModule _this = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)vc.csObj; _this.frameOverTime = arg0; JSMgr.changeJSObj(vc.jsObjID, _this); } }
private extern void get_vectorFieldAttraction_Injected(out ParticleSystem.MinMaxCurve ret);
void ResetParticleRate2(){ //MIGRANT : var rate = new ParticleSystem.MinMaxCurve(); rate.constantMax = 1f; em2.rate = rate; }
void ResetParticleRate3(){ //POVERTY : var rate = new ParticleSystem.MinMaxCurve(); rate.constantMax = 1f; em3.rate = rate; }
public void OnPresidential(SocketIOEvent e) { Debug.Log ("presidential"); var rate = new ParticleSystem.MinMaxCurve(); rate.constantMax = 1000f; em1.rate = rate; Invoke("ResetParticleRate1", 1f); }
void ResetParticleRate1(){ // PRESIDENTIAL : var rate = new ParticleSystem.MinMaxCurve(); rate.constantMax = 1f; em1.rate = rate; }
private extern void get_drag_Injected(out ParticleSystem.MinMaxCurve ret);
private extern void get_rotationAttraction_Injected(out ParticleSystem.MinMaxCurve ret);
private extern void get_vectorFieldSpeed_Injected(out ParticleSystem.MinMaxCurve ret);
public void OnMigrant(SocketIOEvent e) { Debug.Log ("migrant"); var rate = new ParticleSystem.MinMaxCurve(); rate.constantMax = 1000f; em2.rate = rate; Invoke("ResetParticleRate2", 1f); }
private extern void set_rotationAttraction_Injected(ref ParticleSystem.MinMaxCurve value);
static public int constructor(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif int argc = LuaDLL.lua_gettop(l); UnityEngine.ParticleSystem.MinMaxCurve o; if (argc == 2) { System.Single a1; checkType(l, 2, out a1); o = new UnityEngine.ParticleSystem.MinMaxCurve(a1); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(float), typeof(UnityEngine.AnimationCurve))) { System.Single a1; checkType(l, 2, out a1); UnityEngine.AnimationCurve a2; checkType(l, 3, out a2); o = new UnityEngine.ParticleSystem.MinMaxCurve(a1, a2); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 4) { System.Single a1; checkType(l, 2, out a1); UnityEngine.AnimationCurve a2; checkType(l, 3, out a2); UnityEngine.AnimationCurve a3; checkType(l, 4, out a3); o = new UnityEngine.ParticleSystem.MinMaxCurve(a1, a2, a3); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(float), typeof(float))) { System.Single a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); o = new UnityEngine.ParticleSystem.MinMaxCurve(a1, a2); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 0) { o = new UnityEngine.ParticleSystem.MinMaxCurve(); pushValue(l, true); pushObject(l, o); return(2); } return(error(l, "New object failed.")); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
private extern void set_drag_Injected(ref ParticleSystem.MinMaxCurve value);
public void OnPoverty(SocketIOEvent e) { Debug.Log ("poverty"); var rate = new ParticleSystem.MinMaxCurve(); rate.constantMax = 1000f; em3.rate = rate; Invoke("ResetParticleRate3", 1f); }
private extern void set_vectorFieldSpeed_Injected(ref ParticleSystem.MinMaxCurve value);
void ResetParticleRate(){ var rate = new ParticleSystem.MinMaxCurve(); rate.constantMax = 1f; em.rate = rate; }
private extern void set_vectorFieldAttraction_Injected(ref ParticleSystem.MinMaxCurve value);
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); }