void UpdateParticles_GeneralChi(ParticleSpan ps, float toffset) { for (int i = 0; i < ps.Count; i++) { float ba = this.Breath.UnitBreathInPct; float fi = ((float)i) / ((float)(ps.Count - 1)); float mt = Mathf.Repeat(fi + toffset, 1.0f); float a = ba * Mathf.Clamp01(Breath.UnitTo010f(mt) * 5.1f); var pos = ps.Line.SampleAtUnitLength(mt); bool isSpine = false; var clr = Color.green; if (this.IsInfoAvatar) { if (ps == this.ClosestInfoSpan) { // leave alpha as is } else { a = 0.0f; } } ps.LatestOverallAlpha = a; var pi = ps.IndexOf(i); this.Particles [pi].position = pos; this.Particles [pi].startColor = ColorWithAlpha(clr, a); } }
void UpdateParticles_Spinal() { float toffset = 0; //UnitAnimationSpeed * Time.time * (1.0f / this.Particles.Length); bool isOut = (this.Breath.BreathIndex % 2) == 1; var sp = this.CoreSpan; for (int i = 0; i < sp.Count; i++) { float t = this.Breath.UnitTimeInBreath; if (isOut) { t = (1.0f - t); } var pos = this.CoreSpan.Line.SampleAtUnitLength(Mathf.Repeat(t + toffset, 1.0f)); var a = Mathf.Clamp01(Breath.UnitTo010f(t) * 3.1f); var clr = ((!isOut) ? Color.blue : Color.red); this.Particles [i].position = pos; this.Particles [i].startColor = ColorWithAlpha(clr, a); } }
void UpdateParticles_HandToHandSpan(ParticleSpan ps, float toffset) { var offsets = ps.EnsureRandomOffsets(); for (int i = 0; i < ps.Count; i++) { float bt = this.Breath.UnitTimeInBreath; float ba = this.Breath.UnitBreathInPct; float fi = ((float)i) / ((float)(ps.Count - 1)); float mt = Mathf.Repeat(fi + toffset, 1.0f); float a = ba * Mathf.Clamp01(Breath.UnitTo010f(mt) * 5.1f); var basePose = ps.Line.SampleAtLength(Mathf.Clamp01((bt - 0.5f) * 2.0f)); var pos = basePose + (offsets[i] * SphereRadius * Breath.UnitTo010f(bt) * Mathf.Sin(Time.timeSinceLevelLoad * 4.2f + (offsets[i].y * 20))); bool isSpine = false; var clr = Color.green; if (this.IsInfoAvatar) { if (ps == this.ClosestInfoSpan) { // leave alpha as is } else { a = 0.0f; } } ps.LatestOverallAlpha = a; var pi = ps.IndexOf(i); this.Particles [pi].position = pos; this.Particles [pi].startColor = ColorWithAlpha(clr, a); this.Particles [pi].startSize3D = Vector3.one * (DefaultRadius * 2.0f); } }