mirror of
https://github.com/ppy/osu
synced 2024-12-28 18:02:53 +00:00
Using IUpdatableByPlayfield
This commit is contained in:
parent
64bc8da14c
commit
ce0eb0b26f
@ -13,7 +13,7 @@ using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Mods
|
||||
{
|
||||
public class CatchModNoScope : ModNoScope, IApplicableToBeatmap, IApplicableToDrawableRuleset<CatchHitObject>
|
||||
public class CatchModNoScope : ModNoScope, IApplicableToBeatmap, IUpdatableByPlayfield
|
||||
{
|
||||
public override string Description => "Where's the catcher?";
|
||||
|
||||
@ -24,15 +24,12 @@ namespace osu.Game.Rulesets.Catch.Mods
|
||||
BananaShowerPeriods = new PeriodTracker(beatmap.HitObjects.OfType<BananaShower>().Select(b => new Period(b.StartTime - TRANSITION_DURATION, b.EndTime)));
|
||||
}
|
||||
|
||||
public void ApplyToDrawableRuleset(DrawableRuleset<CatchHitObject> drawableRuleset)
|
||||
public virtual void Update(Playfield playfield)
|
||||
{
|
||||
var playfield = (CatchPlayfield)drawableRuleset.Playfield;
|
||||
playfield.OnUpdate += _ =>
|
||||
{
|
||||
bool shouldAlwaysShowCatcher = IsBreakTime.Value || BananaShowerPeriods.IsInAny(playfield.Clock.CurrentTime);
|
||||
float targetAlpha = shouldAlwaysShowCatcher ? 1 : ComboBasedAlpha;
|
||||
playfield.CatcherArea.Alpha = (float)Interpolation.Lerp(playfield.CatcherArea.Alpha, targetAlpha, Math.Clamp(playfield.Time.Elapsed / TRANSITION_DURATION, 0, 1));
|
||||
};
|
||||
var catchPlayfield = (CatchPlayfield)playfield;
|
||||
bool shouldAlwaysShowCatcher = IsBreakTime.Value || BananaShowerPeriods.IsInAny(catchPlayfield.Clock.CurrentTime);
|
||||
float targetAlpha = shouldAlwaysShowCatcher ? 1 : ComboBasedAlpha;
|
||||
catchPlayfield.CatcherArea.Alpha = (float)Interpolation.Lerp(catchPlayfield.CatcherArea.Alpha, targetAlpha, Math.Clamp(catchPlayfield.Time.Elapsed / TRANSITION_DURATION, 0, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user