2018-01-10 13:52:22 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|
|
|
|
{
|
|
|
|
|
public class DrawableBananaShower : DrawableCatchHitObject<BananaShower>
|
|
|
|
|
{
|
2018-01-10 14:38:12 +08:00
|
|
|
|
private readonly Container bananaContainer;
|
2018-01-10 13:52:22 +08:00
|
|
|
|
|
2018-01-10 15:58:20 +08:00
|
|
|
|
public DrawableBananaShower(BananaShower s)
|
|
|
|
|
: base(s)
|
2018-01-10 13:52:22 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
Height = (float)HitObject.Duration;
|
|
|
|
|
X = 0;
|
|
|
|
|
|
2018-01-10 15:58:20 +08:00
|
|
|
|
Child = bananaContainer = new Container
|
2018-01-10 13:52:22 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
RelativeChildOffset = new Vector2(0, (float)HitObject.StartTime),
|
|
|
|
|
RelativeChildSize = new Vector2(1, (float)HitObject.Duration)
|
|
|
|
|
};
|
|
|
|
|
|
2018-01-10 14:38:12 +08:00
|
|
|
|
foreach (var b in s.NestedHitObjects.Cast<BananaShower.Banana>())
|
2018-01-10 15:58:20 +08:00
|
|
|
|
AddNested(new DrawableFruit(b));
|
2018-01-10 13:52:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void AddNested(DrawableHitObject<CatchHitObject> h)
|
|
|
|
|
{
|
|
|
|
|
((DrawableCatchHitObject)h).CheckPosition = o => CheckPosition?.Invoke(o) ?? false;
|
2018-01-10 14:38:12 +08:00
|
|
|
|
bananaContainer.Add(h);
|
2018-01-10 13:52:22 +08:00
|
|
|
|
base.AddNested(h);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|