1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:20:04 +08:00

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 @@ namespace osu.Game.Rulesets.Catch.Tests
public override IReadOnlyList<Type> RequiredTypes => new[] public override IReadOnlyList<Type> RequiredTypes => new[]
{ {
typeof(BananaShower), typeof(BananaShower),
typeof(Banana),
typeof(DrawableBananaShower), typeof(DrawableBananaShower),
typeof(DrawableBanana),
typeof(CatchRuleset), typeof(CatchRuleset),
typeof(DrawableCatchRuleset), typeof(DrawableCatchRuleset),

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Utils; using osu.Framework.Utils;
using osuTK.Graphics; using osuTK.Graphics;
@ -22,6 +23,22 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
return colour ??= getBananaColour(); 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() private Color4 getBananaColour()
{ {
switch (RNG.Next(0, 3)) switch (RNG.Next(0, 3))

View File

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