Centralise trail visibility state management

This commit is contained in:
Bartłomiej Dach 2020-05-10 17:05:30 +02:00
parent 77e5e131c9
commit 5bab53b04c
1 changed files with 11 additions and 13 deletions

View File

@ -74,7 +74,7 @@ protected set
dashing = value;
trails.DisplayTrail = value || HyperDashing;
updateTrailVisibility();
}
}
@ -255,10 +255,7 @@ public void SetHyperDashState(double modifier = 1, float targetPosition = -1)
hyperDashDirection = 0;
if (wasHyperDashing)
{
updateCatcherColour(false);
trails.DisplayTrail &= Dashing;
}
runHyperDashStateTransition(false);
}
else
{
@ -268,16 +265,18 @@ public void SetHyperDashState(double modifier = 1, float targetPosition = -1)
if (!wasHyperDashing)
{
updateCatcherColour(true);
trails.DisplayTrail = true;
trails.DisplayEndGlow();
runHyperDashStateTransition(true);
}
}
}
private void updateCatcherColour(bool hyperDashing)
private void runHyperDashStateTransition(bool hyperDashing)
{
trails.HyperDashTrailsColour = hyperDashColour;
trails.EndGlowSpritesColour = hyperDashEndGlowColour;
updateTrailVisibility();
if (hyperDashing)
{
this.FadeColour(hyperDashColour, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
@ -288,11 +287,10 @@ private void updateCatcherColour(bool hyperDashing)
this.FadeColour(Color4.White, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
this.FadeTo(1f, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
}
trails.HyperDashTrailsColour = hyperDashColour;
trails.EndGlowSpritesColour = hyperDashEndGlowColour;
}
private void updateTrailVisibility() => trails.DisplayTrail = Dashing || HyperDashing;
public bool OnPressed(CatchAction action)
{
switch (action)
@ -393,7 +391,7 @@ protected override void SkinChanged(ISkinSource skin, bool allowFallback)
skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashAfterImage)?.Value ??
hyperDashColour;
updateCatcherColour(HyperDashing);
runHyperDashStateTransition(HyperDashing);
}
protected override void Update()