osu/osu.Game/Screens/Play/ComboEffects.cs

43 lines
1.2 KiB
C#
Raw Normal View History

2019-06-29 16:28:40 +00:00
// 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 osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
2019-06-30 12:58:30 +00:00
using osu.Game.Audio;
2019-06-29 16:28:40 +00:00
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
namespace osu.Game.Screens.Play
{
public class ComboEffects : CompositeDrawable
{
2019-06-30 12:58:30 +00:00
private readonly ScoreProcessor processor;
private SkinnableSound comboBreakSample;
2019-06-29 16:28:40 +00:00
public ComboEffects(ScoreProcessor processor)
{
2019-06-30 12:58:30 +00:00
this.processor = processor;
2019-06-29 16:28:40 +00:00
}
2019-06-30 12:58:30 +00:00
[BackgroundDependencyLoader]
private void load()
2019-06-29 16:28:40 +00:00
{
2019-06-30 12:58:30 +00:00
InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("combobreak"));
2019-06-29 16:28:40 +00:00
}
2019-06-30 12:58:30 +00:00
protected override void LoadComplete()
2019-06-29 16:28:40 +00:00
{
2019-06-30 12:58:30 +00:00
base.LoadComplete();
processor.Combo.BindValueChanged(onComboChange, true);
}
private void onComboChange(ValueChangedEvent<int> combo)
{
if (combo.NewValue == 0 && combo.OldValue > 20)
comboBreakSample?.Play();
2019-06-29 16:28:40 +00:00
}
}
2019-06-30 12:58:30 +00:00
}