static int Emit(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.ParticleSystem), typeof(int))) { UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.ToObject(L, 1); int arg0 = (int)LuaDLL.lua_tonumber(L, 2); obj.Emit(arg0); return(0); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.ParticleSystem), typeof(UnityEngine.ParticleSystem.EmitParams), typeof(int))) { UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.ToObject(L, 1); UnityEngine.ParticleSystem.EmitParams arg0 = (UnityEngine.ParticleSystem.EmitParams)ToLua.ToObject(L, 2); int arg1 = (int)LuaDLL.lua_tonumber(L, 3); obj.Emit(arg0, arg1); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.Emit")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void SpawnProjectile(Projectile temp, Vector3 position, Vector3 direction, Unit from, Status onHit) { if (numAlive >= particles.Length) { throw new System.Exception("Too many projectiles."); } Projectile proj = new Projectile(temp); proj.SetStartPosition(position); proj.position = position; proj.direction = direction; proj.SetFrom(from); proj.SetStatus(onHit); projectiles.Add(proj); EmitParams param = new EmitParams() { position = position, velocity = direction, startLifetime = lifetime }; pS.Emit(param, 1); }
static int QPYX_Emit_YXQP(IntPtr L_YXQP) { try { int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP); if (QPYX_count_YXQP == 2) { UnityEngine.ParticleSystem QPYX_obj_YXQP = (UnityEngine.ParticleSystem)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.ParticleSystem)); int QPYX_arg0_YXQP = (int)LuaDLL.luaL_checknumber(L_YXQP, 2); QPYX_obj_YXQP.Emit(QPYX_arg0_YXQP); return(0); } else if (QPYX_count_YXQP == 3) { UnityEngine.ParticleSystem QPYX_obj_YXQP = (UnityEngine.ParticleSystem)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.ParticleSystem)); UnityEngine.ParticleSystem.EmitParams QPYX_arg0_YXQP = StackTraits <UnityEngine.ParticleSystem.EmitParams> .Check(L_YXQP, 2); int QPYX_arg1_YXQP = (int)LuaDLL.luaL_checknumber(L_YXQP, 3); QPYX_obj_YXQP.Emit(QPYX_arg0_YXQP, QPYX_arg1_YXQP); return(0); } else { return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.ParticleSystem.Emit")); } } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
static int Emit(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2) { ParticleSystem obj = LuaScriptMgr.GetUnityObject <ParticleSystem>(L, 1); int arg0 = (int)LuaScriptMgr.GetNumber(L, 2); obj.Emit(arg0); return(0); } else if (count == 3) { ParticleSystem obj = LuaScriptMgr.GetUnityObject <ParticleSystem>(L, 1); UnityEngine.ParticleSystem.EmitParams arg0 = LuaScriptMgr.GetNetObject <UnityEngine.ParticleSystem.EmitParams>(L, 2); int arg1 = (int)LuaScriptMgr.GetNumber(L, 3); obj.Emit(arg0, arg1); return(0); } else { LuaDLL.luaL_error(L, "invalid arguments to method: ParticleSystem.Emit"); } return(0); }
static int Emit(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject <UnityEngine.ParticleSystem>(L, 1); int arg0 = (int)LuaDLL.luaL_checkinteger(L, 2); obj.Emit(arg0); return(0); } else if (count == 3) { UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject <UnityEngine.ParticleSystem>(L, 1); UnityEngine.ParticleSystem.EmitParams arg0 = StackTraits <UnityEngine.ParticleSystem.EmitParams> .Check(L, 2); int arg1 = (int)LuaDLL.luaL_checkinteger(L, 3); obj.Emit(arg0, arg1); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.Emit")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
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 UnityEngine.ParticleSystem.EmitParams o; o = new UnityEngine.ParticleSystem.EmitParams(); pushValue(l, true); pushValue(l, o); return(2); } 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 }
public void SpawnEffect(VFXType vfxType, Vector3 position, Vector3 direction, int team) { EmitParams param = new EmitParams() { position = position, velocity = direction * directionMult, startLifetime = 0 // Particle will immediately die, spawning its sub emitters }; pS[IndexFromVFXType(vfxType)].Emit(param, 1); }
static bool EmitParams_ResetVelocity(JSVCall vc, int argc) { int len = argc; if (len == 0) { UnityEngine.ParticleSystem.EmitParams argThis = (UnityEngine.ParticleSystem.EmitParams)vc.csObj; argThis.ResetVelocity(); JSMgr.changeJSObj(vc.jsObjID, argThis); } return(true); }
static public int constructor(IntPtr l) { try { UnityEngine.ParticleSystem.EmitParams o; o=new UnityEngine.ParticleSystem.EmitParams(); pushValue(l,true); pushValue(l,o); return 2; } catch(Exception e) { return error(l,e); } }
static public int constructor(IntPtr l) { try { UnityEngine.ParticleSystem.EmitParams o; o = new UnityEngine.ParticleSystem.EmitParams(); pushValue(l, o); return(1); } catch (Exception e) { return(error(l, e)); } }
void spitLava() { if (Random.Range(0, 3) == 0) { ParticleSystem.EmitParams emitParams = new ParticleSystem.EmitParams(); emitParams.position = new Vector3(Random.Range(-3.84f, 3.84f), 0); emitParams.velocity = new Vector3(Random.Range(0.5f, -0.5f), 1f).normalized * 5f; emitParams.startSize = 0.35f; emitParams.startLifetime = 5f; particles.Emit(emitParams, 1); } }
static bool ParticleSystem_Emit__EmitParams__Int32(JSVCall vc, int argc) { int len = argc; if (len == 2) { UnityEngine.ParticleSystem.EmitParams arg0 = (UnityEngine.ParticleSystem.EmitParams)JSMgr.datax.getObject((int)JSApi.GetType.Arg); System.Int32 arg1 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg); ((UnityEngine.ParticleSystem)vc.csObj).Emit(arg0, arg1); } return(true); }
static void EmitParams_startColor(JSVCall vc) { if (vc.bGet) { UnityEngine.ParticleSystem.EmitParams _this = (UnityEngine.ParticleSystem.EmitParams)vc.csObj; var result = _this.startColor; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); } else { UnityEngine.Color32 arg0 = (UnityEngine.Color32)JSMgr.datax.getObject((int)JSApi.GetType.Arg); UnityEngine.ParticleSystem.EmitParams _this = (UnityEngine.ParticleSystem.EmitParams)vc.csObj; _this.startColor = arg0; JSMgr.changeJSObj(vc.jsObjID, _this); } }
static void EmitParams_randomSeed(JSVCall vc) { if (vc.bGet) { UnityEngine.ParticleSystem.EmitParams _this = (UnityEngine.ParticleSystem.EmitParams)vc.csObj; var result = _this.randomSeed; JSApi.setUInt32((int)JSApi.SetType.Rval, (System.UInt32)(result)); } else { System.UInt32 arg0 = (System.UInt32)JSApi.getUInt32((int)JSApi.GetType.Arg); UnityEngine.ParticleSystem.EmitParams _this = (UnityEngine.ParticleSystem.EmitParams)vc.csObj; _this.randomSeed = arg0; JSMgr.changeJSObj(vc.jsObjID, _this); } }
static void EmitParams_velocity(JSVCall vc) { if (vc.bGet) { UnityEngine.ParticleSystem.EmitParams _this = (UnityEngine.ParticleSystem.EmitParams)vc.csObj; var result = _this.velocity; JSApi.setVector3S((int)JSApi.SetType.Rval, result); } else { UnityEngine.Vector3 arg0 = (UnityEngine.Vector3)JSApi.getVector3S((int)JSApi.GetType.Arg); UnityEngine.ParticleSystem.EmitParams _this = (UnityEngine.ParticleSystem.EmitParams)vc.csObj; _this.velocity = arg0; JSMgr.changeJSObj(vc.jsObjID, _this); } }
static void EmitParams_startSize(JSVCall vc) { if (vc.bGet) { UnityEngine.ParticleSystem.EmitParams _this = (UnityEngine.ParticleSystem.EmitParams)vc.csObj; var result = _this.startSize; JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result)); } else { System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg); UnityEngine.ParticleSystem.EmitParams _this = (UnityEngine.ParticleSystem.EmitParams)vc.csObj; _this.startSize = arg0; JSMgr.changeJSObj(vc.jsObjID, _this); } }
static int Emit1(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); var obj = (UnityEngine.ParticleSystem)ToLua.ToObject(L, 1); UnityEngine.ParticleSystem.EmitParams arg0 = StackTraits <UnityEngine.ParticleSystem.EmitParams> .To(L, 2); int arg1 = (int)LuaDLL.lua_tonumber(L, 3); obj.Emit(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private void EmitExplosion(ref Vector3 pos) { int count = UnityEngine.Random.Range(2, 5); while (count != 0) { float xVelocity = UnityEngine.Random.Range(-2.0f, 2.0f) * cameraMultiplier; float yVelocity = UnityEngine.Random.Range(1.0f, 3.0f) * cameraMultiplier; float lifetime = UnityEngine.Random.Range(0.1f, 0.2f); float size = UnityEngine.Random.Range(0.05f, 0.1f) * cameraMultiplier; ParticleSystem.EmitParams param = new ParticleSystem.EmitParams(); param.position = pos; param.velocity = new Vector3(xVelocity, yVelocity, 0.0f); param.startLifetime = lifetime; param.startSize = size; param.startColor = explosionColor; RainExplosionParticleSystem.Emit(param, 1); count--; } }
private void Emit(ParticleSystem p, ref Vector3 pos) { int count = UnityEngine.Random.Range(2, 5); while (count != 0) { float yVelocity = UnityEngine.Random.Range(1.0f, 3.0f); float zVelocity = UnityEngine.Random.Range(-2.0f, 2.0f); float xVelocity = UnityEngine.Random.Range(-2.0f, 2.0f); const float lifetime = 0.75f;// UnityEngine.Random.Range(0.25f, 0.75f); float size = UnityEngine.Random.Range(0.05f, 0.1f); ParticleSystem.EmitParams param = new ParticleSystem.EmitParams(); param.position = pos; param.velocity = new Vector3(xVelocity, yVelocity, zVelocity); param.startLifetime = lifetime; param.startSize = size; param.startColor = color; p.Emit(param, 1); count--; } }
public void SpawnHitscan(Hitscan temp, Vector3 position, Vector3 direction, Unit from, Status onHit, ITargetable goal) { Hitscan scan = new Hitscan(temp); scan.startPosition = position; scan.direction = direction; scan.SetFrom(from); scan.SetStatus(onHit); //hitscans.Add(scan); int index = IndexFromHitscanType(temp.GetHitscanType()); bool noGoal = IsNull(goal); // Raycast or do damage immediately. Use actual distance / hit information to inform visuals Vector3 dif = noGoal ? Vector3.zero : (position - goal.GetPosition()); float length = noGoal ? Raycast(scan) : dif.magnitude; if (!noGoal) // Has goal, do damage manually { goal.Damage(scan.GetDamage(), length, scan.GetDamageType()); vfx.SpawnEffect(VFXType.Hit_Near, position + direction * length, direction, scan.GetFrom().GetTeam()); } Vector3 size = new Vector3(pS[index].main.startSizeX.constant, length, 1); EmitParams param = new EmitParams() { position = position, velocity = direction * directionMult, startSize3D = size, //startColor = Random.value * Color.red + Random.value * Color.green + Random.value * Color.blue, startLifetime = scan.GetLifetime() // 2x just in case. Particles dying prematurely is the worst thing that could happen to this system }; pS[index].Emit(param, 1); }
public void SpawnParticles() { foreach(var info in spawners) { var worldSpacePosition = transform.position + info.Position; var velocity = worldSpacePosition.UnitVectorTo(transform.position) * particleSystem.startSpeed; var emitInfo = new ParticleSystem.EmitParams { velocity = velocity, position = new Vector3(info.Position.x, info.Position.y, -1.5f) }; particleSystem.Emit(emitInfo, 1); } }
protected override void OnPluginPostSolve() { // We do actual emission after the solver has run for (var particleIndex = 0; particleIndex < m_Count; ++particleIndex) { var id = m_MixerData[particleIndex].emitVelocity.w; if (Mathf.Abs(id) < FluvioSettings.kEpsilon) continue; var system = Mathf.Abs(id - 1.0f) < FluvioSettings.kEpsilon ? fluidC : fluidD; m_MixerData[particleIndex].emitVelocity.w = 0; var toSystemSpace = system.simulationSpace == ParticleSystemSimulationSpace.World ? Matrix4x4.identity : Matrix4x4.TRS(system.transform.position, system.transform.rotation, Vector3.one).inverse; // Emit from particle systems #if UNITY_5_3_PLUS var emitParams = new ParticleSystem.EmitParams { position = toSystemSpace.MultiplyPoint3x4(m_MixerData[particleIndex].emitPosition), velocity = toSystemSpace.MultiplyVector(m_MixerData[particleIndex].emitVelocity) }; system.Emit(emitParams, 1); #else system.Emit( toSystemSpace.MultiplyPoint3x4(m_MixerData[particleIndex].emitPosition), toSystemSpace.MultiplyVector(m_MixerData[particleIndex].emitVelocity), system.startSize, system.startLifetime, system.startColor); #endif } }
extern public void Emit(ParticleSystem.EmitParams emitParams, int count);
private void InitializeParticles() { _particleSystem.Stop(); _particleSystem.Clear(); _particleStartTime = Time.time; var tempEmitParams = new List<ParticleSystem.EmitParams>(_points.Length / 2); var tempEmitParam = new ParticleSystem.EmitParams(); for (var i = 0; i < _points.Length; i++) { var sample = Noise.Perlin3D(_points[i], frequency) + 0.5f; var color = gizmoGradient.Evaluate(sample); if (color.a > 0.0005f) { //sample *= 2f; tempEmitParam.position = _points[i]; tempEmitParam.velocity = Vector3.zero; tempEmitParam.startLifetime = particleLifeTime; tempEmitParam.startSize = Mathf.Sqrt(sample * -1f + 1f) * particleSize; tempEmitParam.rotation = sample * 10f; tempEmitParam.velocity = Vector3.up*Mathf.Sin(sample)*-0.06f; tempEmitParam.startColor = color; tempEmitParams.Add(tempEmitParam); //particleSystem.Emit(emit, 1); } } _emitParams = tempEmitParams.ToArray(); _particleSystem.maxParticles = _emitParams.Length; Helper.RandomizeArray(ref _emitParams); _particleSystem.Play(); }
private void Emit() { ParticleSystem.EmitParams emitParams = new ParticleSystem.EmitParams(); Vector3 pos = Vector3.zero; switch (shape) { case KSPParticleEmitter.EmissionShape.Point: pos = Vector3.zero; break; case KSPParticleEmitter.EmissionShape.Line: pos = new Vector3(Random.Range(-shape1D, shape1D) * 0.5f, 0f, 0f); break; case KSPParticleEmitter.EmissionShape.Ellipsoid: pos = Random.insideUnitSphere; pos.Scale(shape3D); break; case KSPParticleEmitter.EmissionShape.Ellipse: pos = Random.insideUnitCircle; pos.x = pos.x * shape2D.x; pos.z = pos.y * shape2D.y; pos.y = 0f; break; case KSPParticleEmitter.EmissionShape.Sphere: pos = Random.insideUnitSphere * shape1D; break; case KSPParticleEmitter.EmissionShape.Cuboid: pos = new Vector3( Random.Range(-shape3D.x, shape3D.x), Random.Range(-shape3D.y, shape3D.y), Random.Range(-shape3D.z, shape3D.z)); break; case KSPParticleEmitter.EmissionShape.Plane: pos = new Vector3(Random.Range(-shape2D.x, shape2D.x), 0f, Random.Range(-shape2D.y, shape2D.y)); break; case KSPParticleEmitter.EmissionShape.Ring: float posFloat = Random.Range(0f, 2f * Mathf.PI); pos = new Vector3(Mathf.Sin(posFloat) * shape2D.x, 0f, Mathf.Cos(posFloat) * shape2D.y); break; } Vector3 vel; if (pe.simulationSpace == ParticleSystemSimulationSpace.Local) { vel = localVelocity + new Vector3( Random.Range(-rndVelocity.x, rndVelocity.x), Random.Range(-rndVelocity.y, rndVelocity.y), Random.Range(-rndVelocity.z, rndVelocity.z)) + go.transform.InverseTransformDirection(worldVelocity); } else { pos = go.transform.TransformPoint(pos); vel = worldVelocity + go.transform.TransformDirection( localVelocity + new Vector3( Random.Range(-rndVelocity.x, rndVelocity.x), Random.Range(-rndVelocity.y, rndVelocity.y), Random.Range(-rndVelocity.z, rndVelocity.z) ) ); } float rotation = rndRotation ? Random.value * 360f : 0f; float angularV = angularVelocity + Random.value * rndAngularVelocity; emitParams.position = pos; emitParams.velocity = vel; emitParams.rotation = rotation; emitParams.angularVelocity = angularV; emitParams.startLifetime = Random.Range(minEnergy, maxEnergy); emitParams.startColor = color; emitParams.startSize = Random.Range(minSize, maxSize); pe.Emit(emitParams, 1); }
protected override void OnPluginPostSolve() { // We do actual emission after the solver has run for (var particleIndex = 0; particleIndex < m_Count; ++particleIndex) { var id = m_MixerData[particleIndex].emitVelocity.w; if (Mathf.Abs(id) < FluvioSettings.kEpsilon) continue; var system = Mathf.Abs(id - 1.0f) < FluvioSettings.kEpsilon ? fluidC : fluidD; m_MixerData[particleIndex].emitVelocity.w = 0; // Emit from particle systems var toSystemSpace = Matrix4x4.identity; if (system.simulationSpace != ParticleSystemSimulationSpace.World) { #if UNITY_5_3_PLUS switch (system.scalingMode) { case ParticleSystemScalingMode.Hierarchy: toSystemSpace = system.transform.localToWorldMatrix; break; case ParticleSystemScalingMode.Local: toSystemSpace = Matrix4x4.TRS(system.transform.position, system.transform.rotation, system.transform.localScale); break; case ParticleSystemScalingMode.Shape: #endif toSystemSpace = Matrix4x4.TRS(system.transform.position, system.transform.rotation, Vector3.one); #if UNITY_5_3_PLUS break; } #endif } #if UNITY_5_3_PLUS var emitParams = new ParticleSystem.EmitParams { position = toSystemSpace.MultiplyPoint3x4(m_MixerData[particleIndex].emitPosition), velocity = toSystemSpace.MultiplyVector(m_MixerData[particleIndex].emitVelocity) }; system.Emit(emitParams, 1); #else system.Emit( toSystemSpace.MultiplyPoint3x4(m_MixerData[particleIndex].emitPosition), toSystemSpace.MultiplyVector(m_MixerData[particleIndex].emitVelocity), system.startSize, system.startLifetime, system.startColor); #endif } }