Example #1
0
        public static Pulse GetRandom(float offset, float timeDeviation)
        {
            Pulse p = new Pulse();

            p.time          = Time.timeSinceLevelLoad + Random.value * timeDeviation;
            p.screenPoint.x = Mathf.Lerp(offset, 1f - offset, Random.value);
            p.screenPoint.y = Mathf.Lerp(offset, 1f - offset, Random.value);
            return(p);
        }
Example #2
0
 public void OnStageClear(StageCleared st)
 {
     //Generate random pulses.
     for (int i = 0; i < 5; i++)
     {
         pulses[i] = Pulse.GetRandom(edgeOffset, maxTimeOffset);
     }
     mat.SetFloatArray("_Impacts", pulses.GetTimes());
     mat.SetVectorArray("_ImpactPoints", new Vector4[] {
         pulses[0].screenPoint,
         pulses[1].screenPoint,
         pulses[2].screenPoint,
         pulses[3].screenPoint,
         pulses[4].screenPoint
     });
 }