Use hit object pooling for Fruit and Banana.

This commit is contained in:
ekrctb
2020-11-30 19:07:50 +09:00
parent 94fd607a7c
commit b76ae525b2
5 changed files with 16 additions and 10 deletions

View File

@ -1,6 +1,7 @@
// 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 JetBrains.Annotations;
using osu.Framework.Graphics;
using osu.Framework.Utils;
@ -10,7 +11,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
{
protected override FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => FruitVisualRepresentation.Banana;
public DrawableBanana(Banana h)
public DrawableBanana()
: this(null)
{
}
public DrawableBanana([CanBeNull] Banana h)
: base(h)
{
}

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Utils;
@ -16,7 +17,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
protected virtual FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => (FruitVisualRepresentation)(indexInBeatmap % 4);
public DrawableFruit(CatchHitObject h)
public DrawableFruit()
: this(null)
{
}
public DrawableFruit([CanBeNull] Fruit h)
: base(h)
{
}