diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs index 6f5e8be92c..92f2977c40 100644 --- a/osu.Game.Rulesets.Catch/UI/Catcher.cs +++ b/osu.Game.Rulesets.Catch/UI/Catcher.cs @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Catch.UI public Container ExplodingFruitTarget; - private Container additiveTarget; + private readonly Container additiveTarget; private Container dashTrails; private Container hyperDashTrails; private Container endGlowSprites; @@ -116,8 +116,10 @@ namespace osu.Game.Rulesets.Catch.UI private int hyperDashDirection; private float hyperDashTargetPosition; - public Catcher(BeatmapDifficulty difficulty = null) + public Catcher(BeatmapDifficulty difficulty = null, Container additiveTarget = null) { + this.additiveTarget = additiveTarget; + RelativePositionAxes = Axes.X; X = 0.5f; @@ -155,27 +157,14 @@ namespace osu.Game.Rulesets.Catch.UI } }; - updateCatcher(); - } - - /// - /// Sets container target to provide catcher additive trails content in. - /// - /// The container to add catcher trails in. - public void SetAdditiveTarget(Container target) - { - if (additiveTarget == target) - return; - - additiveTarget?.RemoveRange(new[] { dashTrails, hyperDashTrails, endGlowSprites }); - - additiveTarget = target; additiveTarget?.AddRange(new[] { - dashTrails ??= new Container { RelativeSizeAxes = Axes.Both, Colour = Color4.White }, - hyperDashTrails ??= new Container { RelativeSizeAxes = Axes.Both, Colour = hyperDashColour }, - endGlowSprites ??= new Container { RelativeSizeAxes = Axes.Both, Colour = hyperDashEndGlowColour }, + dashTrails = new Container { RelativeSizeAxes = Axes.Both, Colour = Color4.White }, + hyperDashTrails = new Container { RelativeSizeAxes = Axes.Both, Colour = hyperDashColour }, + endGlowSprites = new Container { RelativeSizeAxes = Axes.Both, Colour = hyperDashEndGlowColour } }); + + updateCatcher(); } /// diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 641b81599e..1dd94afa9e 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -33,9 +33,7 @@ namespace osu.Game.Rulesets.Catch.UI { RelativeSizeAxes = Axes.X; Height = CATCHER_SIZE; - - Child = MovableCatcher = new Catcher(difficulty); - MovableCatcher.SetAdditiveTarget(this); + Child = MovableCatcher = new Catcher(difficulty, this); } public static float GetCatcherSize(BeatmapDifficulty difficulty)