1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 13:37:46 +08:00

91 lines
3.2 KiB
C#
Raw Normal View History

2018-01-05 20:21:19 +09:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2016-11-14 18:03:20 +09:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
2017-08-03 08:32:38 +09:00
using osu.Framework.Graphics.Containers;
2017-10-10 16:34:01 +09:00
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
using OpenTK;
using OpenTK.Graphics;
2017-04-18 16:05:58 +09:00
namespace osu.Game.Rulesets.Catch.Objects.Drawable
{
2017-10-10 16:34:01 +09:00
public class DrawableFruit : DrawableCatchHitObject<Fruit>
{
2017-10-10 16:34:01 +09:00
public DrawableFruit(Fruit h)
2017-08-08 12:46:37 +09:00
: base(h)
{
Origin = Anchor.Centre;
2017-10-12 22:27:22 +09:00
Size = new Vector2(Pulp.PULP_SIZE * 2.2f, Pulp.PULP_SIZE * 2.8f);
AccentColour = HitObject.ComboColour;
Masking = false;
2017-10-10 16:34:01 +09:00
Rotation = (float)(RNG.NextDouble() - 0.5f) * 40;
}
[BackgroundDependencyLoader]
private void load()
{
Children = new Framework.Graphics.Drawable[]
{
//todo: share this more
new BufferedContainer
{
RelativeSizeAxes = Axes.Both,
CacheDrawnFrameBuffer = true,
Children = new Framework.Graphics.Drawable[]
{
new Pulp
{
RelativePositionAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AccentColour = AccentColour,
Scale = new Vector2(0.6f),
},
new Pulp
{
RelativePositionAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AccentColour = AccentColour,
Y = -0.08f
},
new Pulp
{
RelativePositionAxes = Axes.Both,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AccentColour = AccentColour,
Y = -0.08f
},
new Pulp
{
RelativePositionAxes = Axes.Both,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
AccentColour = AccentColour,
},
}
}
};
if (HitObject.HyperDash)
{
Add(new Pulp
{
RelativePositionAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AccentColour = Color4.Red,
Blending = BlendingMode.Additive,
Alpha = 0.5f,
Scale = new Vector2(2)
});
}
}
}
}