Add random rotation and scale factors to osu!catch bananas

This commit is contained in:
Dean Herbert 2020-03-10 15:59:13 +09:00
parent a6cf6207aa
commit 2b33594400
3 changed files with 21 additions and 3 deletions

View File

@ -18,7 +18,9 @@ public class TestSceneBananaShower : PlayerTestScene
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(BananaShower),
typeof(Banana),
typeof(DrawableBananaShower),
typeof(DrawableBanana),
typeof(CatchRuleset),
typeof(DrawableCatchRuleset),

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Utils;
using osuTK.Graphics;
@ -22,6 +23,22 @@ protected override Color4 GetComboColour(IReadOnlyList<Color4> comboColours)
return colour ??= getBananaColour();
}
protected override void UpdateInitialTransforms()
{
base.UpdateInitialTransforms();
const float end_scale = 0.6f;
const float random_scale_range = 1.6f;
ScaleContainer.ScaleTo(HitObject.Scale * (end_scale + random_scale_range * RNG.NextSingle()))
.Then().ScaleTo(HitObject.Scale * end_scale, HitObject.TimePreempt);
const float random_angle_range = 180;
ScaleContainer.RotateTo(random_angle_range * (RNG.NextSingle() * 2 - 1))
.Then().RotateTo(random_angle_range * (RNG.NextSingle() * 2 - 1), HitObject.TimePreempt);
}
private Color4 getBananaColour()
{
switch (RNG.Next(0, 3))

View File

@ -38,12 +38,11 @@ protected ScreenTestScene()
private void addExitAllScreensStep()
{
AddUntilStep("exit all screens", () =>
AddStep("exit all screens", () =>
{
if (Stack.CurrentScreen == null) return true;
if (Stack.CurrentScreen == null) return;
Stack.Exit();
return false;
});
}
}