1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 16:10:48 +08:00

Merge pull request #24604 from peppy/fix-star-fountain-directions

Fix star fountain directions not matching stable
This commit is contained in:
Bartłomiej Dach
2023-08-21 17:00:51 +02:00
committed by GitHub
Unverified
3 changed files with 29 additions and 9 deletions
@@ -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);
}
+25 -5
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;
}
+3 -3
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);