void OnDrawGizmos() { if (drawpath) { Gizmos.color = Color.grey; if (flowpositions.Count > 0) { Vector3 lpos = Vector3.zero; for (int i = 0; i < flowpositions.Count; i++) { MegaFlowPos fpos = flowpositions[i]; Gizmos.color = Color.white; if (i > 0) { Gizmos.DrawLine(lpos, fpos.pos); } Gizmos.color = Color.green; Gizmos.DrawSphere(fpos.pos, 0.1f); lpos = fpos.pos; } } DrawMoveGizmo(); } Gizmos.DrawIcon(transform.position, "MegaFlowIcon.png", true); }
void AddPos(Vector3 pos, Vector3 vel, Matrix4x4 tm, Matrix4x4 tm1, float flowscale) { MegaFlowPos fpos = new MegaFlowPos(); fpos.Set(pos, vel, tm, tm1, flowscale, flowtime); flowpositions.Add(fpos); }
void ProcessPos() { for (int i = 0; i < flowpositions.Count; i++) { MegaFlowPos fpos = flowpositions[i]; fpos.fpos += fpos.vel * Time.deltaTime; fpos.time -= Time.deltaTime; fpos.alpha = 1.0f - (fpos.time / fpos.stime); if (usefalloff) { fpos.falloff = falloffcrv.Evaluate(fpos.alpha); } else { fpos.falloff = 1.0f; } if (fpos.time < 0.0f) { flowpositions.RemoveAt(i); i--; } else { if (frames.Count > 0) { fpos.frame = 0; for (int f = frames.Count - 1; f >= 0; f--) { if (fpos.alpha > frames[f].time) { fpos.frame = f; break; } } } } } }
void UpdateLast(Vector3 pos, Vector3 vel, Matrix4x4 tm, Matrix4x4 tm1, float flowscale) { MegaFlowPos fpos = flowpositions[flowpositions.Count - 1]; fpos.Set(pos, vel, tm, tm1, flowscale, flowtime); }
void AddPos(Vector3 pos, Vector3 vel, Matrix4x4 tm, Matrix4x4 tm1, float flowscale) { MegaFlowPos fpos = new MegaFlowPos(); fpos.Set(pos, vel, tm, tm1, flowscale, flowtime); flowpositions.Add(fpos); }