From 91d877e8931da7e4d738a57189dbb5a1e4b60902 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Oct 2022 18:52:01 +0900 Subject: [PATCH] Set `LifetimeEnd` once rather than computing on every access --- osu.Game.Rulesets.Osu/Skinning/SmokeSegment.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/SmokeSegment.cs b/osu.Game.Rulesets.Osu/Skinning/SmokeSegment.cs index 245026dc0b..18e0bc5baa 100644 --- a/osu.Game.Rulesets.Osu/Skinning/SmokeSegment.cs +++ b/osu.Game.Rulesets.Osu/Skinning/SmokeSegment.cs @@ -24,15 +24,6 @@ public abstract class SmokeSegment : Drawable, ITexturedShaderDrawable public IShader? TextureShader { get; private set; } public IShader? RoundedTextureShader { get; private set; } - public override double LifetimeEnd - { - get - { - double initialFadeOutDurationTrunc = Math.Min(initial_fade_out_duration, SmokeEndTime - SmokeStartTime); - return SmokeEndTime + final_fade_out_duration + initialFadeOutDurationTrunc / re_fade_in_speed + initialFadeOutDurationTrunc / final_fade_out_speed; - } - } - private float? radius; protected float Radius @@ -153,6 +144,9 @@ public void AddPosition(Vector2 position, double time) public void FinishDrawing(double time) { SmokeEndTime = time; + + double initialFadeOutDurationTrunc = Math.Min(initial_fade_out_duration, SmokeEndTime - SmokeStartTime); + LifetimeEnd = SmokeEndTime + final_fade_out_duration + initialFadeOutDurationTrunc / re_fade_in_speed + initialFadeOutDurationTrunc / final_fade_out_speed; } protected override DrawNode CreateDrawNode() => new SmokeDrawNode(this);