1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 19:47:24 +08:00
osu-lazer/osu.Game.Rulesets.Mania/Timing/Drawables/DrawableGravityTimingChange.cs
smoogipooo 1da5d508fa aaaaa
2017-06-02 11:35:51 +09:00

39 lines
1.2 KiB
C#

using System;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Framework.Physics;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Timing.Drawables
{
public class DrawableGravityTimingChange : DrawableTimingChange
{
private const double acceleration = 9.8f;
private const double terminal_velocity = 50f;
private const double duration = 2000;
public DrawableGravityTimingChange(TimingChange timingChange)
: base(timingChange)
{
}
protected override void Update()
{
base.Update();
var parent = (TimingChangeContainer)Parent;
double elapsed = Math.Max(0, Time.Current - TimingChange.Time);
// @ Current == TimingChange.Time - duration -> Y = TimingChange.Time
// @ Current == TimingChange.Time -> Y = 0
// @ Current == TimingChange.Time + x -> Y = -f(x)
double acceleration = elapsed / 2 / 1000 / 1000;
Content.Y = (float)(TimingChange.Time - 1 / 2f * acceleration * elapsed * elapsed);
}
}
}