1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 22:22:56 +08:00

Add tick sample.

This commit is contained in:
Dean Herbert 2017-02-16 13:39:01 +09:00
parent 19eb58e724
commit 2640c2ac43
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
2 changed files with 21 additions and 1 deletions

View File

@ -2,9 +2,13 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps.Samples;
using osu.Game.Modes.Objects.Drawables;
using OpenTK;
using OpenTK.Graphics;
@ -48,6 +52,22 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
};
}
private AudioSample sample;
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower();
sample = audio.Sample.Get($@"Gameplay/{sampleSet}-slidertick");
}
protected override void PlaySample()
{
sample?.Play();
}
protected override void CheckJudgement(bool userTriggered)
{
if (Judgement.TimeOffset >= 0)

View File

@ -66,7 +66,7 @@ namespace osu.Game.Modes.Objects.Drawables
sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}");
}
protected void PlaySample()
protected virtual void PlaySample()
{
sample?.Play();
}