mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Add osu!catch banana catching sounds
This commit is contained in:
parent
e60c085bf2
commit
6b9102b2a4
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Game.Audio;
|
||||||
using osu.Game.Rulesets.Catch.Judgements;
|
using osu.Game.Rulesets.Catch.Judgements;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
|
||||||
@ -8,8 +10,27 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
{
|
{
|
||||||
public class Banana : Fruit
|
public class Banana : Fruit
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Index of banana in current shower.
|
||||||
|
/// </summary>
|
||||||
|
public int BananaIndex;
|
||||||
|
|
||||||
public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana;
|
public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana;
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new CatchBananaJudgement();
|
public override Judgement CreateJudgement() => new CatchBananaJudgement();
|
||||||
|
|
||||||
|
private static readonly List<HitSampleInfo> samples = new List<HitSampleInfo> { new BananaHitSampleInfo() };
|
||||||
|
|
||||||
|
public Banana()
|
||||||
|
{
|
||||||
|
Samples = samples;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class BananaHitSampleInfo : HitSampleInfo
|
||||||
|
{
|
||||||
|
private static string[] lookupNames { get; } = { "metronomelow", "catch-banana" };
|
||||||
|
|
||||||
|
public override IEnumerable<string> LookupNames => lookupNames;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,21 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
if (spacing <= 0)
|
if (spacing <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (double i = StartTime; i <= EndTime; i += spacing)
|
double time = StartTime;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while (time <= EndTime)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
AddNested(new Banana
|
AddNested(new Banana
|
||||||
{
|
{
|
||||||
Samples = Samples,
|
StartTime = time,
|
||||||
StartTime = i
|
BananaIndex = i,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
time += spacing;
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
float getRandomAngle() => 180 * (RNG.NextSingle() * 2 - 1);
|
float getRandomAngle() => 180 * (RNG.NextSingle() * 2 - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void PlaySamples()
|
||||||
|
{
|
||||||
|
base.PlaySamples();
|
||||||
|
if (Samples != null)
|
||||||
|
Samples.Frequency.Value = 0.77f + ((Banana)HitObject).BananaIndex * 0.006f;
|
||||||
|
}
|
||||||
|
|
||||||
private Color4 getBananaColour()
|
private Color4 getBananaColour()
|
||||||
{
|
{
|
||||||
switch (RNG.Next(0, 3))
|
switch (RNG.Next(0, 3))
|
||||||
|
Loading…
Reference in New Issue
Block a user