mirror of
https://github.com/osukey/osukey.git
synced 2025-06-08 12:58:01 +09:00
Split animation logic to its own method
Also add a guard, to bypass all of it if the foreground layer is not in fact animatable.
This commit is contained in:
parent
8ac0a759f0
commit
38f2a27f53
@ -26,7 +26,6 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
private Bindable<int> currentCombo { get; } = new BindableInt();
|
private Bindable<int> currentCombo { get; } = new BindableInt();
|
||||||
|
|
||||||
private int animationFrame;
|
private int animationFrame;
|
||||||
private int multiplier;
|
|
||||||
private double beatLength;
|
private double beatLength;
|
||||||
|
|
||||||
// required for editor blueprints (not sure why these circle pieces are zero size).
|
// required for editor blueprints (not sure why these circle pieces are zero size).
|
||||||
@ -94,6 +93,14 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
foreach (var c in InternalChildren)
|
foreach (var c in InternalChildren)
|
||||||
c.Scale = new Vector2(DrawHeight / 128);
|
c.Scale = new Vector2(DrawHeight / 128);
|
||||||
|
|
||||||
|
if (foregroundLayer is IFramedAnimation animatableForegroundLayer)
|
||||||
|
animateForegroundLayer(animatableForegroundLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void animateForegroundLayer(IFramedAnimation animatableForegroundLayer)
|
||||||
|
{
|
||||||
|
int multiplier;
|
||||||
|
|
||||||
if (currentCombo.Value >= 150)
|
if (currentCombo.Value >= 150)
|
||||||
{
|
{
|
||||||
multiplier = 2;
|
multiplier = 2;
|
||||||
@ -104,7 +111,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(foregroundLayer as IFramedAnimation)?.GotoFrame(0);
|
animatableForegroundLayer.GotoFrame(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +121,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
|
|
||||||
animationFrame = Time.Current % ((beatLength * 2) / multiplier) >= beatLength / multiplier ? 0 : 1;
|
animationFrame = Time.Current % ((beatLength * 2) / multiplier) >= beatLength / multiplier ? 0 : 1;
|
||||||
|
|
||||||
(foregroundLayer as IFramedAnimation)?.GotoFrame(animationFrame);
|
animatableForegroundLayer.GotoFrame(animationFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user