2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|
|
|
|
{
|
|
|
|
|
public class DrawableBananaShower : DrawableCatchHitObject<BananaShower>
|
|
|
|
|
{
|
|
|
|
|
private readonly Container bananaContainer;
|
|
|
|
|
|
2019-03-24 22:40:43 +08:00
|
|
|
|
public DrawableBananaShower(BananaShower s, Func<CatchHitObject, DrawableHitObject<CatchHitObject>> createDrawableRepresentation = null)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
: base(s)
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
Origin = Anchor.BottomLeft;
|
|
|
|
|
X = 0;
|
|
|
|
|
|
2019-03-25 12:47:28 +08:00
|
|
|
|
AddInternal(bananaContainer = new Container { RelativeSizeAxes = Axes.Both });
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-06-12 03:43:01 +08:00
|
|
|
|
foreach (var b in s.NestedHitObjects.Cast<Banana>())
|
2019-03-24 22:40:43 +08:00
|
|
|
|
AddNested(createDrawableRepresentation?.Invoke(b));
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void AddNested(DrawableHitObject h)
|
|
|
|
|
{
|
|
|
|
|
((DrawableCatchHitObject)h).CheckPosition = o => CheckPosition?.Invoke(o) ?? false;
|
|
|
|
|
bananaContainer.Add(h);
|
|
|
|
|
base.AddNested(h);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|