mirror of
https://github.com/osukey/osukey.git
synced 2025-05-21 05:27:17 +09: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
|
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?";
|
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)));
|
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;
|
var catchPlayfield = (CatchPlayfield)playfield;
|
||||||
playfield.OnUpdate += _ =>
|
bool shouldAlwaysShowCatcher = IsBreakTime.Value || BananaShowerPeriods.IsInAny(catchPlayfield.Clock.CurrentTime);
|
||||||
{
|
|
||||||
bool shouldAlwaysShowCatcher = IsBreakTime.Value || BananaShowerPeriods.IsInAny(playfield.Clock.CurrentTime);
|
|
||||||
float targetAlpha = shouldAlwaysShowCatcher ? 1 : ComboBasedAlpha;
|
float targetAlpha = shouldAlwaysShowCatcher ? 1 : ComboBasedAlpha;
|
||||||
playfield.CatcherArea.Alpha = (float)Interpolation.Lerp(playfield.CatcherArea.Alpha, targetAlpha, Math.Clamp(playfield.Time.Elapsed / TRANSITION_DURATION, 0, 1));
|
catchPlayfield.CatcherArea.Alpha = (float)Interpolation.Lerp(catchPlayfield.CatcherArea.Alpha, targetAlpha, Math.Clamp(catchPlayfield.Time.Elapsed / TRANSITION_DURATION, 0, 1));
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user