Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
    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);
        }
    }