Enable NRT in explosion-related classes and streamline null handling

This commit is contained in:
Bartłomiej Dach
2021-08-12 21:09:08 +02:00
parent 98ce69d1d3
commit 68f454b51a
5 changed files with 11 additions and 13 deletions

View File

@ -1,28 +1,25 @@
// 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.Graphics;
using osu.Game.Rulesets.Catch.Skinning.Default;
using osu.Game.Rulesets.Objects.Pooling;
using osu.Game.Skinning;
#nullable enable
namespace osu.Game.Rulesets.Catch.UI
{
public class HitExplosion : PoolableDrawableWithLifetime<HitExplosionEntry>
{
private SkinnableDrawable skinnableExplosion;
private readonly SkinnableDrawable skinnableExplosion;
public HitExplosion()
{
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = skinnableExplosion = new SkinnableDrawable(new CatchSkinComponent(CatchSkinComponents.HitExplosion), _ => new DefaultHitExplosion())
{
CentreComponent = false,
@ -44,8 +41,11 @@ namespace osu.Game.Rulesets.Catch.UI
apply(Entry);
}
private void apply(HitExplosionEntry entry)
private void apply(HitExplosionEntry? entry)
{
if (entry == null)
return;
ApplyTransformsAt(double.MinValue, true);
ClearTransforms(true);