Merge branch 'master' into caught-object-refactor

This commit is contained in:
Dean Herbert
2020-12-04 14:12:33 +09:00
committed by GitHub
46 changed files with 863 additions and 258 deletions

View File

@ -3,7 +3,6 @@
using JetBrains.Annotations;
using osu.Framework.Graphics;
using osu.Framework.Utils;
namespace osu.Game.Rulesets.Catch.Objects.Drawables
{
@ -21,6 +20,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
{
}
protected override void LoadComplete()
{
base.LoadComplete();
// start time affects the random seed which is used to determine the banana colour
StartTimeBindable.BindValueChanged(_ => UpdateComboColour());
}
protected override void UpdateInitialTransforms()
{
base.UpdateInitialTransforms();
@ -28,14 +35,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
const float end_scale = 0.6f;
const float random_scale_range = 1.6f;
ScaleContainer.ScaleTo(HitObject.Scale * (end_scale + random_scale_range * RNG.NextSingle()))
ScaleContainer.ScaleTo(HitObject.Scale * (end_scale + random_scale_range * RandomSingle(3)))
.Then().ScaleTo(HitObject.Scale * end_scale, HitObject.TimePreempt);
ScaleContainer.RotateTo(getRandomAngle())
ScaleContainer.RotateTo(getRandomAngle(1))
.Then()
.RotateTo(getRandomAngle(), HitObject.TimePreempt);
.RotateTo(getRandomAngle(2), HitObject.TimePreempt);
float getRandomAngle() => 180 * (RNG.NextSingle() * 2 - 1);
float getRandomAngle(int series) => 180 * (RandomSingle(series) * 2 - 1);
}
public override void PlaySamples()

View File

@ -7,6 +7,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Utils;
namespace osu.Game.Rulesets.Catch.Objects.Drawables
{
@ -18,12 +19,19 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
protected override float SamplePlaybackPosition => HitObject.X / CatchPlayfield.WIDTH;
public int RandomSeed => HitObject?.RandomSeed ?? 0;
protected DrawableCatchHitObject([CanBeNull] CatchHitObject hitObject)
: base(hitObject)
{
Anchor = Anchor.BottomLeft;
}
/// <summary>
/// Get a random number in range [0,1) based on seed <see cref="RandomSeed"/>.
/// </summary>
public float RandomSingle(int series) => StatelessRNG.NextSingle(RandomSeed, series);
protected override void OnApply()
{
base.OnApply();

View File

@ -4,7 +4,6 @@
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Utils;
using osu.Game.Rulesets.Catch.Objects.Drawables.Pieces;
using osu.Game.Skinning;
@ -45,7 +44,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
base.UpdateInitialTransforms();
// roughly matches osu-stable
float startRotation = RNG.NextSingle() * 20;
float startRotation = RandomSingle(1) * 20;
double duration = HitObject.TimePreempt + 2000;
ScaleContainer.RotateTo(startRotation).RotateTo(startRotation + 720, duration);

View File

@ -5,7 +5,7 @@ using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Utils;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Catch.Objects.Drawables.Pieces;
using osu.Game.Skinning;
@ -30,8 +30,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
[BackgroundDependencyLoader]
private void load()
{
ScaleContainer.Rotation = (float)(RNG.NextDouble() - 0.5f) * 40;
IndexInBeatmap.BindValueChanged(change =>
{
VisualRepresentation.Value = GetVisualRepresentation(change.NewValue);
@ -41,6 +39,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
HyperDash.BindValueChanged(_ => updatePiece(), true);
}
protected override void UpdateInitialTransforms()
{
base.UpdateInitialTransforms();
ScaleContainer.RotateTo((RandomSingle(1) - 0.5f) * 40);
}
private void updatePiece()
{
ScaleContainer.Child = new SkinnableDrawable(