Example #1
0
        public override void Tick(Kugelmatik kugelmatik, TimeSpan time)
        {
            if (current >= Entries.Length)
                current = 0;

            ShowEntry entry = Entries[current];

            TimeSpan endTime = timeSum + entry.Time; // Zeitpunkt wenn der Eintrag vorbei ist
            TimeSpan interpolationStart = endTime - InterpolationTime;

            // nächsten Eintrag
            if (time >= endTime)
            {
                timeSum += endTime;
                current++;
            }
            else if (time >= interpolationStart)
            {
                ShowEntry next;
                if (current + 1 >= Entries.Length)
                    next = Entries[0];
                else
                    next = Entries[current + 1];

                float pos = (float)((time - interpolationStart).TotalMilliseconds / InterpolationTime.TotalMilliseconds);

                for (int x = 0; x < kugelmatik.StepperCountX; x++)
                    for (int y = 0; y < kugelmatik.StepperCountY; y++)
                    {
                        Stepper stepper = kugelmatik.GetStepperByPosition(x, y);
                        ushort a = entry.Choreography.GetHeight(stepper.Cluster, time, x, y);
                        ushort b = next.Choreography.GetHeight(stepper.Cluster, time, x, y);

                        stepper.Set((ushort)MathHelper.Lerp(a, b, pos));
                    }
            }
            else
                ChoreographyDirect.ApplyFunction(kugelmatik, time, entry.Choreography);
        }
Example #2
0
 public override IEnumerable<Stepper> EnumerateSteppers(Kugelmatik kugelmatik)
 {
     yield return kugelmatik.GetStepperByPosition(StepperX, StepperY);
 }