public override void Update(float dt) { if (Delay > 0) { Delay -= dt; return; } T += dt; if (T > 0.3f) { if (Run.Level != null && Run.Level.Biome is CaveBiome) { R = Math.Max(0, R - dt * 3 * Mod); G = Math.Max(0, G - dt * 0.3f * Mod); B = Math.Max(0, B - dt * Mod); } else { R = Math.Max(0, R - dt * 0.3f * Mod); G = Math.Max(0, G - dt * Mod); B = Math.Max(0, B - dt * 3 * Mod); } } if (Growing) { Scale += dt; if (Scale >= ScaleTar) { Scale = ScaleTar; Growing = false; } } else { Scale -= dt * (Target.HasValue ? 0.33f : 0.5f); if (Scale <= 0) { Done = true; return; } } Vy += dt * Mod * 20; if (Target.HasValue) { var t = Target.Value; var dx = t.X - Position.X - Offset.X; var dy = t.Y - Position.Y - Offset.Y; var d = MathUtils.Distance(Vx, Vy) + dt * 30; var angle = Math.Atan2(dy, dx); var va = Math.Atan2(-Vy, -Vx); va = MathUtils.LerpAngle(va, angle, dt * 4); Vx = (float)-Math.Cos(va) * d; Vy = (float)-Math.Sin(va) * d; } Offset.X -= Vx * dt; Offset.Y -= Vy * dt; if (Owner != null) { X = Owner.CenterX; Y = Owner.Bottom; if (Owner.TryGetComponent <ZComponent>(out var z)) { Y -= z.Z; } } if (Hurts) { GetComponent <CircleBodyComponent>().Position = Position + Offset; } }