Exemple #1
0
        public override IEnumerator _Next(EntityPlayer player)
        {
            /* Over should keep some memory (position), and regenerate toward player
             */
            long        start_time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
            Emplacement placeBase  = new Emplacement(player, opt);

            placeBase.direction = Vectors.Float.Randomize(this.rand, 1f); // useless for peak
            Printer.Log(46, "MultiEffect._Next() placeBase", player, placeBase.position, placeBase.direction);
            foreach (int p in Cycler.Over())
            {
                if (Cycler.dt >= 0 && DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() - start_time > (long)(Cycler.dt * 1000))
                {
                    yield break;
                }
                Printer.Log(41, "_Next iterating Over");
                Vector3 maybeFollowing = (this.isFollowing) ? player.GetPosition() : placeBase.position;
                int     q = -1;
                foreach (Emplacement place in Iter.On(Placer.Get(maybeFollowing)))
                {
                    q = q + 1;
                    if (q >= Repeater.n)
                    {
                        break;
                    }
                    if (place.valid)
                    {
                        Printer.Log(40, "MultiEffect._Next iterating Clones", place); // last before null (firestorm)
                        // float state = ((float) q) / Repeater.copies;
                        OptionEffect rdm = Randomize();
                        Printer.Log(40, "_Next Randomized", p, q, opt);
                        Printer.Log(40, "_Next Place", p, q, place);
                        this.Effect1(player, place, rdm);
                    }
                    else
                    {
                        Printer.Log(40, "Invalid place:", q, place, place.valid_msg);
                    }
                    yield return(Repeater.Yield);
                }
                yield return(Cycler.Yield);
            }
        }