public override void Update(LevelTime levelTime) { base.Update(levelTime); var progress = (Angle - startAngle) / (endAngle - startAngle); progress = MathHelper.Clamp(progress, 0, 1); progress = MathEx.EaseInOutSine(progress); Radius = MathHelper.Lerp(startRadius, endRadius, progress); }
public void Update(LevelTime lt) { // TODO: Fix move speed & spawn speed if (!Config.GameSettings.DrawOuterRings) { return; } var elapsed = lt.ElapsedMs; for (int i = 0; i < rings.Count; i++) { // despawn rings if they've been offscreen for too long if (rings[i].Radius > MaxRingRadius) { rings.RemoveAt(i); i--; continue; } // update radius / line thickness of rings on screen var radiusSpeed = (float)(elapsed * 0.05 * Speed); rings[i].Radius += (float)(Math.Pow(rings[i].LineThickness / arenaCircle.LineThickness, 1.5) * lt.TimeWarp * radiusSpeed); rings[i].LineThickness = arenaCircle.LineThickness * (rings[i].Radius / arenaCircle.Radius); rings[i].Center = arenaCircle.Center; var color = ringColor; if (FadeIn) { var fadeInDuration = (float)(300 / lt.TimeWarp); var alpha = 1f; if (rings[i].Age < fadeInDuration) { var progress = rings[i].Age / fadeInDuration; alpha = MathEx.EaseInOutSine(progress); } rings[i].BorderColor = new Color(color, alpha); } rings[i].Update(lt); } // determine if new rings should be spawned if (SpawnNewRings) { timeSinceLastSpawn += elapsed * Math.Min(1, lt.TimeWarp); if (lt.TimeWarp > 0.00001f && timeSinceLastSpawn > SpawnRate) { SpawnNewRing(); timeSinceLastSpawn = 0; } } }