Move public methods upwards

This commit is contained in:
Dean Herbert 2020-12-04 14:36:40 +09:00
parent 8988023407
commit d3a17b65d5
1 changed files with 25 additions and 25 deletions

View File

@ -266,24 +266,17 @@ public void SetHyperDashState(double modifier = 1, float targetPosition = -1)
}
}
private void runHyperDashStateTransition(bool hyperDashing)
public void UpdatePosition(float position)
{
updateTrailVisibility();
position = Math.Clamp(position, 0, CatchPlayfield.WIDTH);
if (hyperDashing)
{
this.FadeColour(hyperDashColour, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
this.FadeTo(0.2f, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
}
else
{
this.FadeColour(Color4.White, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
this.FadeTo(1f, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
}
if (position == X)
return;
Scale = new Vector2(Math.Abs(Scale.X) * (position > X ? 1 : -1), Scale.Y);
X = position;
}
private void updateTrailVisibility() => trails.DisplayTrail = Dashing || HyperDashing;
public bool OnPressed(CatchAction action)
{
switch (action)
@ -322,17 +315,6 @@ public void OnReleased(CatchAction action)
}
}
public void UpdatePosition(float position)
{
position = Math.Clamp(position, 0, CatchPlayfield.WIDTH);
if (position == X)
return;
Scale = new Vector2(Math.Abs(Scale.X) * (position > X ? 1 : -1), Scale.Y);
X = position;
}
/// <summary>
/// Drop any fruit off the plate.
/// </summary>
@ -343,6 +325,24 @@ public void UpdatePosition(float position)
/// </summary>
public void Explode() => clearPlate(DroppedObjectAnimation.Explode);
private void runHyperDashStateTransition(bool hyperDashing)
{
updateTrailVisibility();
if (hyperDashing)
{
this.FadeColour(hyperDashColour, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
this.FadeTo(0.2f, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
}
else
{
this.FadeColour(Color4.White, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
this.FadeTo(1f, HYPER_DASH_TRANSITION_DURATION, Easing.OutQuint);
}
}
private void updateTrailVisibility() => trails.DisplayTrail = Dashing || HyperDashing;
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
{
base.SkinChanged(skin, allowFallback);