Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Update()
- {
- m_updateTime += Time.deltaTime;
- if (m_updateTime < INTERVAL) return;
- m_updateTime = 0f;
- if (m_onlyOnNoMap && !ZoneSystem.instance.GetGlobalKey(NOMAP_KEY))
- {
- ps.emission.enabled = false;
- return;
- }
- if (Player.m_localPlayer == null || activeEvents.Count == 0)
- {
- ps.emission.enabled = false;
- return;
- }
- var vel = ps.velocityOverLifetime;
- vel.space = ParticleSystemSimulationSpace.World;
- Vector3 best = Vector3.positiveInfinity;
- foreach (var ev in activeEvents)
- {
- Vector3 d = ev.position - Player.m_localPlayer.transform.position;
- if (d.magnitude < best.magnitude) best = d;
- }
- Vector3 dir = best.normalized;
- vel.x = dir.x;
- vel.z = dir.z;
- float t = Mathf.Max(0f, best.magnitude - ev.radius);
- ps.emission.rateOverTimeMultiplier = m_strengthByDistance.Evaluate(t) * m_maxStrength;
- ps.emission.enabled = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment