1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +08:00

Fix star fountain directions not matching stable

This commit is contained in:
Dean Herbert 2023-08-21 17:59:24 +09:00
parent 4915b2563c
commit e7d61e0002
3 changed files with 29 additions and 9 deletions

View File

@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Menus
foreach (var fountain in Children.OfType<StarFountain>())
{
if (RNG.NextSingle() > 0.8f)
fountain.Shoot();
fountain.Shoot(RNG.Next(-1, 2));
}
}, 150);
}

View File

@ -2,10 +2,10 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics;
using osu.Framework.Utils;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
@ -13,6 +13,9 @@ namespace osu.Game.Screens.Menu
{
public partial class KiaiMenuFountains : BeatSyncedContainer
{
private StarFountain leftFountain = null!;
private StarFountain rightFountain = null!;
[BackgroundDependencyLoader]
private void load()
{
@ -20,13 +23,13 @@ namespace osu.Game.Screens.Menu
Children = new[]
{
new StarFountain
leftFountain = new StarFountain
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
X = 250,
},
new StarFountain
rightFountain = new StarFountain
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
@ -58,8 +61,25 @@ namespace osu.Game.Screens.Menu
if (lastTrigger != null && Clock.CurrentTime - lastTrigger < 500)
return;
foreach (var fountain in Children.OfType<StarFountain>())
fountain.Shoot();
int direction = RNG.Next(-1, 2);
switch (direction)
{
case -1:
leftFountain.Shoot(1);
rightFountain.Shoot(-1);
break;
case 0:
leftFountain.Shoot(0);
rightFountain.Shoot(0);
break;
case 1:
leftFountain.Shoot(-1);
rightFountain.Shoot(1);
break;
}
lastTrigger = Clock.CurrentTime;
}

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Menu
InternalChild = spewer = new StarFountainSpewer();
}
public void Shoot() => spewer.Shoot();
public void Shoot(int direction) => spewer.Shoot(direction);
protected override void SkinChanged(ISkinSource skin)
{
@ -81,10 +81,10 @@ namespace osu.Game.Screens.Menu
return lastShootDirection * x_velocity_from_direction * (float)(1 - 2 * (Clock.CurrentTime - lastShootTime!.Value) / shoot_duration) + getRandomVariance(x_velocity_random_variance);
}
public void Shoot()
public void Shoot(int direction)
{
lastShootTime = Clock.CurrentTime;
lastShootDirection = RNG.Next(-1, 2);
lastShootDirection = direction;
}
private static float getRandomVariance(float variance) => RNG.NextSingle(-variance, variance);