public void Loop() { LoopResultStates.Clear(); // update input. controller.Loop(this); // position and angle memory. ox = x; oy = y; odx = dx; ody = dy; oa = a; oda = da; // overridable control and friction physics. LoopControlPhysics(); LoopFrictionPhysics(); LoopCollisionPhysics(); // advance position. x += dx; y += dy; oa = a % 360 + oa - a; a = a % 360 + da; }
public void Loop() { LoopResultStates.Clear(); for (var i = 0; i < elementList.Count; i++) { var element = elementList[i]; if (i == elementList.Count - elementsToDestroy) // hide the tail elements. { element.Width = 0; element.Color = ColorEx.Black; } else // decay the visible elements. { element.Width *= 0.65f; element.Color *= 0.6f; } } if (trailState == TrailState.Stopping) // allow decay. { elementsToDestroy--; elementPositions[elementList.Count - 1].Origin = finalPosition; elementPositions[elementList.Count - 1].Direction = Vector3.Zero; if (elementsToDestroy == 0) // remove completely. { LoopResultStates.Remove = true; } else { RemoveTail(); } } else // continue to follow. { AddHead(); RemoveTail(); } }