Replace LifetimeAfterSmokeEnd with abstract LifetimeEnd

This commit is contained in:
Alden Wu 2022-09-20 09:44:01 -07:00
parent 3ec16063bd
commit ddbd69dc67
3 changed files with 5 additions and 5 deletions

View File

@ -15,7 +15,7 @@ public class DefaultSmoke : Smoke
private const double fade_out_duration = 50;
private const float alpha = 0.5f;
protected override double LifetimeAfterSmokeEnd => fade_out_delay + fade_out_duration + (SmokeEndTime - SmokeStartTime) / fade_out_speed;
public override double LifetimeEnd => SmokeEndTime + fade_out_delay + fade_out_duration + (SmokeEndTime - SmokeStartTime) / fade_out_speed;
public DefaultSmoke()
{

View File

@ -37,12 +37,12 @@ public class LegacySmoke : Smoke
protected int RotationSeed { get; set; } = RNG.Next();
protected override double LifetimeAfterSmokeEnd
public override double LifetimeEnd
{
get
{
double initialFadeOutDurationTrunc = Math.Min(initial_fade_out_duration, SmokeEndTime - SmokeStartTime);
return final_fade_out_duration + initialFadeOutDurationTrunc / re_fade_in_speed + initialFadeOutDurationTrunc / final_fade_out_speed;
return SmokeEndTime + final_fade_out_duration + initialFadeOutDurationTrunc / re_fade_in_speed + initialFadeOutDurationTrunc / final_fade_out_speed;
}
}

View File

@ -69,7 +69,6 @@ protected Vector2 BottomRight
}
}
protected abstract double LifetimeAfterSmokeEnd { get; }
protected virtual float PointInterval => Radius * 7f / 8;
protected bool IsActive { get; private set; }
@ -206,6 +205,8 @@ private void adaptBounds(Vector2 position)
BottomRight = new Vector2(BottomRight.X, position.Y);
}
public abstract override double LifetimeEnd { get; }
private void onSmokeEnded(double time)
{
if (!IsActive)
@ -213,7 +214,6 @@ private void onSmokeEnded(double time)
IsActive = false;
SmokeEndTime = time;
LifetimeEnd = time + LifetimeAfterSmokeEnd + 100;
}
protected abstract override DrawNode CreateDrawNode();