mirror of
https://github.com/ppy/osu.git
synced 2025-02-24 05:03:22 +08:00
The previous logic was very wrong, as the check would only occur on each beat. But that's not how kiai sections work – they can be placed at any timestamp, even if that doesn't align with a beat. In addition, the rate limiting has been removed because it didn't exist on stable and causes some fountains to be missed. Overlap scenarios are already handled internally by the `StarFountain` class. Closes https://github.com/ppy/osu/issues/31855.
79 lines
2.1 KiB
C#
79 lines
2.1 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using System;
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Utils;
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
namespace osu.Game.Screens.Menu
|
|
{
|
|
public partial class KiaiMenuFountains : BeatSyncedContainer
|
|
{
|
|
private StarFountain leftFountain = null!;
|
|
private StarFountain rightFountain = null!;
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load()
|
|
{
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
Children = new[]
|
|
{
|
|
leftFountain = new StarFountain
|
|
{
|
|
Anchor = Anchor.BottomLeft,
|
|
Origin = Anchor.BottomLeft,
|
|
X = 250,
|
|
},
|
|
rightFountain = new StarFountain
|
|
{
|
|
Anchor = Anchor.BottomRight,
|
|
Origin = Anchor.BottomRight,
|
|
X = -250,
|
|
},
|
|
};
|
|
}
|
|
|
|
private bool isTriggered;
|
|
|
|
protected override void Update()
|
|
{
|
|
base.Update();
|
|
|
|
if (EffectPoint.KiaiMode && !isTriggered)
|
|
{
|
|
bool isNearEffectPoint = Math.Abs(BeatSyncSource.Clock.CurrentTime - EffectPoint.Time) < 500;
|
|
if (isNearEffectPoint)
|
|
Shoot();
|
|
}
|
|
|
|
isTriggered = EffectPoint.KiaiMode;
|
|
}
|
|
|
|
public void 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;
|
|
}
|
|
}
|
|
}
|
|
}
|