1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 13:47:24 +08:00
osu-lazer/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs

42 lines
1.5 KiB
C#

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Transforms;
using OpenTK;
using osu.Game.Modes.Objects.Types;
namespace osu.Game.Modes.Catch.Objects.Drawable
{
internal class DrawableFruit : Sprite
{
private CatchBaseHit h;
public DrawableFruit(CatchBaseHit h)
{
this.h = h;
Origin = Anchor.Centre;
Scale = new Vector2(0.1f);
RelativePositionAxes = Axes.Y;
Position = new Vector2(h.Position.X, -0.1f);
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
Texture = textures.Get(@"Menu/logo");
double endTime = (h as IHasEndTime)?.EndTime ?? h.StartTime;
double duration = endTime - h.StartTime;
Transforms.Add(new TransformPosition { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position.X, -0.1f), EndValue = new Vector2(h.Position.X, 0.9f) });
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 });
Expire(true);
}
}
}