Fix TestSceneFruitObjects

This commit is contained in:
ekrctb 2020-11-17 18:13:32 +09:00
parent eba17ecab2
commit eebce1f914

View File

@ -6,6 +6,7 @@ using NUnit.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawables; using osu.Game.Rulesets.Catch.Objects.Drawables;
using osu.Game.Rulesets.Objects;
using osuTK; using osuTK;
namespace osu.Game.Rulesets.Catch.Tests namespace osu.Game.Rulesets.Catch.Tests
@ -36,17 +37,29 @@ namespace osu.Game.Rulesets.Catch.Tests
Scale = 1.5f, Scale = 1.5f,
}; };
return new DrawableTinyDroplet(droplet) return new TestDrawableTinyDroplet(droplet)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
RelativePositionAxes = Axes.None, RelativePositionAxes = Axes.None,
Position = Vector2.Zero, Position = Vector2.Zero,
Alpha = 1,
LifetimeStart = double.NegativeInfinity,
LifetimeEnd = double.PositiveInfinity,
}; };
} }
private class TestDrawableTinyDroplet : DrawableTinyDroplet
{
public TestDrawableTinyDroplet(TinyDroplet tinyDroplet)
: base(tinyDroplet)
{
}
protected override void OnApply(HitObject hitObject)
{
base.OnApply(hitObject);
LifetimeStart = double.NegativeInfinity;
LifetimeEnd = double.PositiveInfinity;
}
}
private Drawable createDrawableDroplet(bool hyperdash = false) private Drawable createDrawableDroplet(bool hyperdash = false)
{ {
var droplet = new TestCatchDroplet var droplet = new TestCatchDroplet
@ -55,17 +68,29 @@ namespace osu.Game.Rulesets.Catch.Tests
HyperDashTarget = hyperdash ? new Banana() : null HyperDashTarget = hyperdash ? new Banana() : null
}; };
return new DrawableDroplet(droplet) return new TestDrawableDroplet(droplet)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
RelativePositionAxes = Axes.None, RelativePositionAxes = Axes.None,
Position = Vector2.Zero, Position = Vector2.Zero,
Alpha = 1,
LifetimeStart = double.NegativeInfinity,
LifetimeEnd = double.PositiveInfinity,
}; };
} }
private class TestDrawableDroplet : DrawableDroplet
{
public TestDrawableDroplet(Droplet droplet)
: base(droplet)
{
}
protected override void OnApply(HitObject hitObject)
{
base.OnApply(hitObject);
LifetimeStart = double.NegativeInfinity;
LifetimeEnd = double.PositiveInfinity;
}
}
private Drawable createDrawable(FruitVisualRepresentation rep, bool hyperdash = false) private Drawable createDrawable(FruitVisualRepresentation rep, bool hyperdash = false)
{ {
Fruit fruit = new TestCatchFruit(rep) Fruit fruit = new TestCatchFruit(rep)
@ -74,17 +99,29 @@ namespace osu.Game.Rulesets.Catch.Tests
HyperDashTarget = hyperdash ? new Banana() : null HyperDashTarget = hyperdash ? new Banana() : null
}; };
return new DrawableFruit(fruit) return new TestDrawableFruit(fruit)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
RelativePositionAxes = Axes.None, RelativePositionAxes = Axes.None,
Position = Vector2.Zero, Position = Vector2.Zero,
Alpha = 1,
LifetimeStart = double.NegativeInfinity,
LifetimeEnd = double.PositiveInfinity,
}; };
} }
private class TestDrawableFruit : DrawableFruit
{
public TestDrawableFruit(Fruit fruit)
: base(fruit)
{
}
protected override void OnApply(HitObject hitObject)
{
base.OnApply(hitObject);
LifetimeStart = double.NegativeInfinity;
LifetimeEnd = double.PositiveInfinity;
}
}
public class TestCatchFruit : Fruit public class TestCatchFruit : Fruit
{ {
public TestCatchFruit(FruitVisualRepresentation rep) public TestCatchFruit(FruitVisualRepresentation rep)