mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 10:33:22 +08:00
Merge pull request #8199 from peppy/add-banana-scale-rotate
Add random rotation and scale factors to osu!catch bananas
This commit is contained in:
commit
42bc8bc50d
@ -18,7 +18,9 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(BananaShower),
|
||||
typeof(Banana),
|
||||
typeof(DrawableBananaShower),
|
||||
typeof(DrawableBanana),
|
||||
|
||||
typeof(CatchRuleset),
|
||||
typeof(DrawableCatchRuleset),
|
||||
|
@ -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,23 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
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);
|
||||
|
||||
ScaleContainer.RotateTo(getRandomAngle())
|
||||
.Then()
|
||||
.RotateTo(getRandomAngle(), HitObject.TimePreempt);
|
||||
|
||||
float getRandomAngle() => 180 * (RNG.NextSingle() * 2 - 1);
|
||||
}
|
||||
|
||||
private Color4 getBananaColour()
|
||||
{
|
||||
switch (RNG.Next(0, 3))
|
||||
|
Loading…
Reference in New Issue
Block a user