mirror of https://github.com/ppy/osu
Make catch hit lighting logic not dependent on caught object
This commit is contained in:
parent
004c705aa9
commit
94a59ac3b2
|
@ -215,10 +215,19 @@ public void OnNewResult(DrawableCatchHitObject drawableObject, JudgementResult r
|
||||||
catchResult.CatcherAnimationState = CurrentState;
|
catchResult.CatcherAnimationState = CurrentState;
|
||||||
catchResult.CatcherHyperDash = HyperDashing;
|
catchResult.CatcherHyperDash = HyperDashing;
|
||||||
|
|
||||||
if (!(drawableObject.HitObject is PalpableCatchHitObject hitObject)) return;
|
if (!(drawableObject is DrawablePalpableCatchHitObject palpableObject)) return;
|
||||||
|
|
||||||
|
var hitObject = palpableObject.HitObject;
|
||||||
|
|
||||||
if (result.IsHit)
|
if (result.IsHit)
|
||||||
placeCaughtObject(hitObject);
|
{
|
||||||
|
var positionInStack = computePositionInStack(new Vector2(palpableObject.X - X, 0), palpableObject.DisplayRadius);
|
||||||
|
|
||||||
|
placeCaughtObject(hitObject, positionInStack);
|
||||||
|
|
||||||
|
if (hitLighting.Value)
|
||||||
|
addLighting(hitObject, positionInStack.X, drawableObject.AccentColour.Value);
|
||||||
|
}
|
||||||
|
|
||||||
// droplet doesn't affect the catcher state
|
// droplet doesn't affect the catcher state
|
||||||
if (hitObject is TinyDroplet) return;
|
if (hitObject is TinyDroplet) return;
|
||||||
|
@ -441,16 +450,14 @@ private void updateState(CatcherAnimationState state)
|
||||||
updateCatcher();
|
updateCatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void placeCaughtObject(PalpableCatchHitObject source)
|
private void placeCaughtObject(PalpableCatchHitObject source, Vector2 position)
|
||||||
{
|
{
|
||||||
var caughtObject = createCaughtObject(source);
|
var caughtObject = createCaughtObject(source);
|
||||||
|
|
||||||
if (caughtObject == null) return;
|
if (caughtObject == null) return;
|
||||||
|
|
||||||
var positionInStack = computePositionInStack(new Vector2(source.X - X, 0), caughtObject.DisplayRadius);
|
|
||||||
|
|
||||||
caughtObject.RelativePositionAxes = Axes.None;
|
caughtObject.RelativePositionAxes = Axes.None;
|
||||||
caughtObject.Position = positionInStack;
|
caughtObject.Position = position;
|
||||||
caughtObject.IsOnPlate = true;
|
caughtObject.IsOnPlate = true;
|
||||||
|
|
||||||
caughtObject.Anchor = Anchor.TopCentre;
|
caughtObject.Anchor = Anchor.TopCentre;
|
||||||
|
@ -461,8 +468,6 @@ private void placeCaughtObject(PalpableCatchHitObject source)
|
||||||
|
|
||||||
caughtFruitContainer.Add(caughtObject);
|
caughtFruitContainer.Add(caughtObject);
|
||||||
|
|
||||||
addLighting(caughtObject);
|
|
||||||
|
|
||||||
if (!caughtObject.StaysOnPlate)
|
if (!caughtObject.StaysOnPlate)
|
||||||
removeFromPlate(caughtObject, DroppedObjectAnimation.Explode);
|
removeFromPlate(caughtObject, DroppedObjectAnimation.Explode);
|
||||||
}
|
}
|
||||||
|
@ -485,15 +490,13 @@ private Vector2 computePositionInStack(Vector2 position, float displayRadius)
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addLighting(DrawablePalpableCatchHitObject caughtObject)
|
private void addLighting(CatchHitObject hitObject, float x, Color4 colour)
|
||||||
{
|
{
|
||||||
if (!hitLighting.Value) return;
|
|
||||||
|
|
||||||
HitExplosion hitExplosion = hitExplosionPool.Get();
|
HitExplosion hitExplosion = hitExplosionPool.Get();
|
||||||
hitExplosion.HitObject = caughtObject.HitObject;
|
hitExplosion.HitObject = hitObject;
|
||||||
hitExplosion.X = caughtObject.X;
|
hitExplosion.X = x;
|
||||||
hitExplosion.Scale = new Vector2(caughtObject.HitObject.Scale);
|
hitExplosion.Scale = new Vector2(hitObject.Scale);
|
||||||
hitExplosion.ObjectColour = caughtObject.AccentColour.Value;
|
hitExplosion.ObjectColour = colour;
|
||||||
hitExplosionContainer.Add(hitExplosion);
|
hitExplosionContainer.Add(hitExplosion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue