Ejemplo n.º 1
0
 public static IEnumerable LinearBurst(this IEnumerable data,
                                       int count,
                                       float dSpeed,
                                       Func<FireData, bool> filter = null)
 {
     return data.Burst(count.Wrap(), (fd) => fd.Speed += dSpeed, null, filter);
 }
Ejemplo n.º 2
0
        public static IEnumerable RadialBurst(this IEnumerable data,
                                              Func<FireData, int> count,
                                              Func<FireData, float> range,
                                              Func<FireData, bool> filter = null)
        {

            if (count == null || range == null)
                throw new ArgumentNullException();

            float delta = 0f;

            Action<FireData, int> setup =
                delegate(FireData fd, int currentCount)
                {

                    if (currentCount <= 1)
                        return;

                    float currentRange = range(fd);
                    delta = currentRange / currentCount;
                    fd.Rotation -= 0.5f * currentRange;
                };

            Action<FireData> edit = (fd) => fd.Rotation += delta;

            return data.Burst(count, edit, setup, filter);
        }