Make taiko hitobject properly unproxy when rewound

This commit is contained in:
smoogipoo
2018-06-11 21:45:19 +09:00
parent f07e6370ca
commit 22dfe46572
4 changed files with 70 additions and 34 deletions

View File

@ -20,12 +20,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableSwell : DrawableTaikoHitObject<Swell>
{
/// <summary>
/// Invoked when the swell has reached the hit target, i.e. when CurrentTime >= StartTime.
/// This is only ever invoked once.
/// </summary>
public event Action OnStart;
private const float target_ring_thick_border = 1.4f;
private const float target_ring_thin_border = 1f;
private const float target_ring_scale = 5f;
@ -40,7 +34,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
/// </summary>
private int userHits;
private bool hasStarted;
private bool hasProxied;
private readonly SwellSymbolPiece symbol;
public DrawableSwell(Swell swell)
@ -48,7 +42,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
FillMode = FillMode.Fit;
AddInternal(bodyContainer = new Container
Content.Add(bodyContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Depth = 1,
@ -177,6 +171,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
switch (state)
{
case ArmedState.Idle:
hasProxied = false;
UnproxyContent();
break;
case ArmedState.Hit:
bodyContainer.Delay(untilJudgement).ScaleTo(1.4f, out_transition_time);
break;
@ -195,10 +193,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
X = Math.Max(0, X);
double t = Math.Min(HitObject.StartTime, Time.Current);
if (t == HitObject.StartTime && !hasStarted)
if (t == HitObject.StartTime && !hasProxied)
{
OnStart?.Invoke();
hasStarted = true;
ProxyContent();
hasProxied = true;
}
}