2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-11-28 17:39:45 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.Textures;
|
|
|
|
|
using osu.Framework.Input.Bindings;
|
|
|
|
|
using osu.Framework.MathUtils;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets.Catch.Objects;
|
2018-01-04 17:13:59 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.Objects.Drawable;
|
2018-01-12 17:35:28 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.Replays;
|
2018-01-04 17:13:59 +08:00
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
2017-11-28 17:39:45 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using OpenTK;
|
2017-12-01 18:24:48 +08:00
|
|
|
|
using OpenTK.Graphics;
|
2017-11-28 17:39:45 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.UI
|
|
|
|
|
{
|
2018-01-22 17:46:59 +08:00
|
|
|
|
public class CatcherArea : Container
|
2017-11-28 17:39:45 +08:00
|
|
|
|
{
|
|
|
|
|
public const float CATCHER_SIZE = 172;
|
|
|
|
|
|
2017-12-01 18:58:00 +08:00
|
|
|
|
protected readonly Catcher MovableCatcher;
|
2017-11-28 17:39:45 +08:00
|
|
|
|
|
2018-01-12 20:46:50 +08:00
|
|
|
|
public Func<CatchHitObject, DrawableHitObject<CatchHitObject>> GetVisualRepresentation;
|
|
|
|
|
|
2017-11-28 17:39:45 +08:00
|
|
|
|
public Container ExplodingFruitTarget
|
|
|
|
|
{
|
2017-12-01 18:58:00 +08:00
|
|
|
|
set { MovableCatcher.ExplodingFruitTarget = value; }
|
2017-11-28 17:39:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CatcherArea(BeatmapDifficulty difficulty = null)
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
Height = CATCHER_SIZE;
|
2017-12-01 18:58:00 +08:00
|
|
|
|
Child = MovableCatcher = new Catcher(difficulty)
|
2017-11-28 17:39:45 +08:00
|
|
|
|
{
|
|
|
|
|
AdditiveTarget = this,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-12 21:07:21 +08:00
|
|
|
|
private DrawableCatchHitObject lastPlateableFruit;
|
|
|
|
|
|
2018-01-04 17:13:59 +08:00
|
|
|
|
public void OnJudgement(DrawableCatchHitObject fruit, Judgement judgement)
|
2017-11-28 17:39:45 +08:00
|
|
|
|
{
|
2018-01-12 20:46:50 +08:00
|
|
|
|
if (judgement.IsHit && fruit.CanBePlated)
|
2018-01-04 17:13:59 +08:00
|
|
|
|
{
|
2018-01-12 20:46:50 +08:00
|
|
|
|
var caughtFruit = (DrawableCatchHitObject)GetVisualRepresentation?.Invoke(fruit.HitObject);
|
|
|
|
|
|
2018-01-12 21:07:21 +08:00
|
|
|
|
if (caughtFruit == null) return;
|
|
|
|
|
|
|
|
|
|
caughtFruit.RelativePositionAxes = Axes.None;
|
|
|
|
|
caughtFruit.Position = new Vector2(MovableCatcher.ToLocalSpace(fruit.ScreenSpaceDrawQuad.Centre).X - MovableCatcher.DrawSize.X / 2, 0);
|
|
|
|
|
|
|
|
|
|
caughtFruit.Anchor = Anchor.TopCentre;
|
|
|
|
|
caughtFruit.Origin = Anchor.Centre;
|
|
|
|
|
caughtFruit.Scale *= 0.7f;
|
|
|
|
|
caughtFruit.LifetimeEnd = double.MaxValue;
|
2018-01-12 20:46:50 +08:00
|
|
|
|
|
|
|
|
|
MovableCatcher.Add(caughtFruit);
|
2018-01-12 21:07:21 +08:00
|
|
|
|
|
|
|
|
|
lastPlateableFruit = caughtFruit;
|
2018-01-04 17:13:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-12 21:30:21 +08:00
|
|
|
|
if (fruit.HitObject.LastInCombo)
|
2018-01-04 17:13:59 +08:00
|
|
|
|
{
|
2018-01-12 21:30:21 +08:00
|
|
|
|
if (judgement.IsHit)
|
2018-01-12 21:07:21 +08:00
|
|
|
|
{
|
2018-01-12 21:30:21 +08:00
|
|
|
|
// this is required to make this run after the last caught fruit runs UpdateState at least once.
|
|
|
|
|
// TODO: find a better alternative
|
|
|
|
|
if (lastPlateableFruit.IsLoaded)
|
2018-01-12 21:07:21 +08:00
|
|
|
|
MovableCatcher.Explode();
|
|
|
|
|
else
|
2018-01-12 21:30:21 +08:00
|
|
|
|
lastPlateableFruit.OnLoadComplete = _ => { MovableCatcher.Explode(); };
|
2018-01-12 21:07:21 +08:00
|
|
|
|
}
|
2018-01-12 21:30:21 +08:00
|
|
|
|
else
|
|
|
|
|
MovableCatcher.Drop();
|
|
|
|
|
}
|
2017-11-28 17:39:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-02-01 18:22:31 +08:00
|
|
|
|
protected override void UpdateAfterChildren()
|
2018-01-12 17:35:28 +08:00
|
|
|
|
{
|
2018-02-01 18:22:31 +08:00
|
|
|
|
base.UpdateAfterChildren();
|
2018-01-12 17:35:28 +08:00
|
|
|
|
|
2018-01-22 17:46:59 +08:00
|
|
|
|
var state = GetContainingInputManager().CurrentState as CatchFramedReplayInputHandler.CatchReplayState;
|
2018-01-12 17:35:28 +08:00
|
|
|
|
|
2018-01-22 17:46:59 +08:00
|
|
|
|
if (state?.CatcherX != null)
|
2018-01-12 17:35:28 +08:00
|
|
|
|
MovableCatcher.X = state.CatcherX.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool OnReleased(CatchAction action) => false;
|
|
|
|
|
|
2017-12-01 18:58:00 +08:00
|
|
|
|
public bool AttemptCatch(CatchHitObject obj) => MovableCatcher.AttemptCatch(obj);
|
2017-11-28 17:39:45 +08:00
|
|
|
|
|
|
|
|
|
public class Catcher : Container, IKeyBindingHandler<CatchAction>
|
|
|
|
|
{
|
|
|
|
|
private Texture texture;
|
|
|
|
|
|
|
|
|
|
private Container<DrawableHitObject> caughtFruit;
|
|
|
|
|
|
|
|
|
|
public Container ExplodingFruitTarget;
|
|
|
|
|
|
|
|
|
|
public Container AdditiveTarget;
|
|
|
|
|
|
|
|
|
|
public Catcher(BeatmapDifficulty difficulty = null)
|
|
|
|
|
{
|
|
|
|
|
RelativePositionAxes = Axes.X;
|
|
|
|
|
X = 0.5f;
|
|
|
|
|
|
2017-11-28 18:43:26 +08:00
|
|
|
|
Origin = Anchor.TopCentre;
|
|
|
|
|
Anchor = Anchor.TopLeft;
|
2017-11-28 17:39:45 +08:00
|
|
|
|
|
|
|
|
|
Size = new Vector2(CATCHER_SIZE);
|
2017-11-28 18:43:26 +08:00
|
|
|
|
if (difficulty != null)
|
|
|
|
|
Scale = new Vector2(1.0f - 0.7f * (difficulty.CircleSize - 5) / 5);
|
2017-11-28 17:39:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(TextureStore textures)
|
|
|
|
|
{
|
|
|
|
|
texture = textures.Get(@"Play/Catch/fruit-catcher-idle");
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
caughtFruit = new Container<DrawableHitObject>
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.BottomCentre,
|
2018-01-04 16:25:51 +08:00
|
|
|
|
},
|
|
|
|
|
createCatcherSprite(),
|
2017-11-28 17:39:45 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int currentDirection;
|
|
|
|
|
|
|
|
|
|
private bool dashing;
|
|
|
|
|
|
|
|
|
|
protected bool Dashing
|
|
|
|
|
{
|
|
|
|
|
get { return dashing; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == dashing) return;
|
|
|
|
|
|
|
|
|
|
dashing = value;
|
|
|
|
|
|
2017-12-01 18:24:48 +08:00
|
|
|
|
Trail |= dashing;
|
2017-11-28 17:39:45 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-01 18:24:48 +08:00
|
|
|
|
private bool trail;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Activate or deactive the trail. Will be automatically deactivated when conditions to keep the trail displayed are no longer met.
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected bool Trail
|
|
|
|
|
{
|
|
|
|
|
get { return trail; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == trail) return;
|
|
|
|
|
|
|
|
|
|
trail = value;
|
|
|
|
|
|
|
|
|
|
if (Trail)
|
|
|
|
|
beginTrail();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void beginTrail()
|
2017-11-28 17:39:45 +08:00
|
|
|
|
{
|
2017-12-01 18:24:48 +08:00
|
|
|
|
Trail &= dashing || HyperDashing;
|
|
|
|
|
Trail &= AdditiveTarget != null;
|
|
|
|
|
|
|
|
|
|
if (!Trail) return;
|
2017-11-28 17:39:45 +08:00
|
|
|
|
|
|
|
|
|
var additive = createCatcherSprite();
|
|
|
|
|
|
|
|
|
|
additive.Anchor = Anchor;
|
2017-11-28 18:43:26 +08:00
|
|
|
|
additive.OriginPosition = additive.OriginPosition + new Vector2(DrawWidth / 2, 0); // also temporary to align sprite correctly.
|
2017-11-28 17:39:45 +08:00
|
|
|
|
additive.Position = Position;
|
|
|
|
|
additive.Scale = Scale;
|
2017-12-01 18:24:48 +08:00
|
|
|
|
additive.Colour = HyperDashing ? Color4.Red : Color4.White;
|
2017-11-28 17:39:45 +08:00
|
|
|
|
additive.RelativePositionAxes = RelativePositionAxes;
|
|
|
|
|
additive.Blending = BlendingMode.Additive;
|
|
|
|
|
|
|
|
|
|
AdditiveTarget.Add(additive);
|
|
|
|
|
|
|
|
|
|
additive.FadeTo(0.4f).FadeOut(800, Easing.OutQuint).Expire();
|
|
|
|
|
|
2017-12-01 18:24:48 +08:00
|
|
|
|
Scheduler.AddDelayed(beginTrail, HyperDashing ? 25 : 50);
|
2017-11-28 17:39:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Sprite createCatcherSprite() => new Sprite
|
|
|
|
|
{
|
|
|
|
|
Size = new Vector2(CATCHER_SIZE),
|
|
|
|
|
FillMode = FillMode.Fill,
|
|
|
|
|
Texture = texture,
|
|
|
|
|
OriginPosition = new Vector2(-3, 10) // temporary until the sprite is aligned correctly.
|
|
|
|
|
};
|
|
|
|
|
|
2017-12-01 18:24:48 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Add a caught fruit to the catcher's stack.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="fruit">The fruit that was caught.</param>
|
2017-11-28 17:39:45 +08:00
|
|
|
|
public void Add(DrawableHitObject fruit)
|
|
|
|
|
{
|
2018-01-04 16:27:17 +08:00
|
|
|
|
float ourRadius = fruit.DrawSize.X / 2 * fruit.Scale.X;
|
|
|
|
|
float theirRadius = 0;
|
2017-11-28 17:39:45 +08:00
|
|
|
|
|
2018-01-04 16:27:17 +08:00
|
|
|
|
const float allowance = 6;
|
|
|
|
|
|
|
|
|
|
while (caughtFruit.Any(f =>
|
|
|
|
|
f.LifetimeEnd == double.MaxValue &&
|
2018-01-12 21:07:21 +08:00
|
|
|
|
Vector2Extensions.Distance(f.Position, fruit.Position) < (ourRadius + (theirRadius = f.DrawSize.X / 2 * f.Scale.X)) / (allowance / 2)))
|
2017-11-28 17:39:45 +08:00
|
|
|
|
{
|
2018-01-04 16:27:17 +08:00
|
|
|
|
float diff = (ourRadius + theirRadius) / allowance;
|
|
|
|
|
fruit.X += (RNG.NextSingle() - 0.5f) * 2 * diff;
|
|
|
|
|
fruit.Y -= RNG.NextSingle() * diff;
|
2017-11-28 17:39:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 16:51:34 +08:00
|
|
|
|
fruit.X = MathHelper.Clamp(fruit.X, -CATCHER_SIZE / 2, CATCHER_SIZE / 2);
|
|
|
|
|
|
2017-11-28 17:39:45 +08:00
|
|
|
|
caughtFruit.Add(fruit);
|
2017-12-01 18:24:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Let the catcher attempt to catch a fruit.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="fruit">The fruit to catch.</param>
|
|
|
|
|
/// <returns>Whether the catch is possible.</returns>
|
|
|
|
|
public bool AttemptCatch(CatchHitObject fruit)
|
|
|
|
|
{
|
2018-01-03 20:31:16 +08:00
|
|
|
|
double halfCatcherWidth = CATCHER_SIZE * Math.Abs(Scale.X) * 0.5f;
|
2017-12-01 18:24:48 +08:00
|
|
|
|
|
|
|
|
|
// this stuff wil disappear once we move fruit to non-relative coordinate space in the future.
|
|
|
|
|
var catchObjectPosition = fruit.X * CatchPlayfield.BASE_WIDTH;
|
|
|
|
|
var catcherPosition = Position.X * CatchPlayfield.BASE_WIDTH;
|
|
|
|
|
|
|
|
|
|
var validCatch =
|
2018-01-03 20:31:16 +08:00
|
|
|
|
catchObjectPosition >= catcherPosition - halfCatcherWidth &&
|
|
|
|
|
catchObjectPosition <= catcherPosition + halfCatcherWidth;
|
2017-12-01 18:24:48 +08:00
|
|
|
|
|
2017-12-01 18:58:00 +08:00
|
|
|
|
if (validCatch && fruit.HyperDash)
|
2017-12-01 19:07:28 +08:00
|
|
|
|
{
|
2017-12-01 18:58:00 +08:00
|
|
|
|
HyperDashModifier = Math.Abs(fruit.HyperDashTarget.X - fruit.X) / Math.Abs(fruit.HyperDashTarget.StartTime - fruit.StartTime) / BASE_SPEED;
|
2017-12-01 19:07:28 +08:00
|
|
|
|
HyperDashDirection = fruit.HyperDashTarget.X - fruit.X;
|
|
|
|
|
}
|
2017-12-01 18:58:00 +08:00
|
|
|
|
else
|
|
|
|
|
HyperDashModifier = 1;
|
2017-12-01 18:24:48 +08:00
|
|
|
|
|
|
|
|
|
return validCatch;
|
2017-11-28 17:39:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-01 18:58:00 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether we are hypderdashing or not.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool HyperDashing => hyperDashModifier != 1;
|
|
|
|
|
|
|
|
|
|
private double hyperDashModifier = 1;
|
|
|
|
|
|
2017-12-01 19:08:49 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The direction in which hyperdash is allowed. 0 allows both directions.
|
|
|
|
|
/// </summary>
|
2017-12-01 19:07:28 +08:00
|
|
|
|
public double HyperDashDirection;
|
|
|
|
|
|
2017-12-01 19:08:49 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The speed modifier resultant from hyperdash. Will trigger hyperdash when not equal to 1.
|
|
|
|
|
/// </summary>
|
2017-12-01 18:58:00 +08:00
|
|
|
|
public double HyperDashModifier
|
|
|
|
|
{
|
|
|
|
|
get { return hyperDashModifier; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == hyperDashModifier) return;
|
|
|
|
|
hyperDashModifier = value;
|
|
|
|
|
|
|
|
|
|
const float transition_length = 180;
|
|
|
|
|
|
|
|
|
|
if (HyperDashing)
|
|
|
|
|
{
|
2017-12-01 19:13:46 +08:00
|
|
|
|
this.FadeColour(Color4.OrangeRed, transition_length, Easing.OutQuint);
|
2017-12-01 18:58:00 +08:00
|
|
|
|
this.FadeTo(0.2f, transition_length, Easing.OutQuint);
|
|
|
|
|
Trail = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-12-01 19:07:28 +08:00
|
|
|
|
HyperDashDirection = 0;
|
2017-12-01 18:58:00 +08:00
|
|
|
|
this.FadeColour(Color4.White, transition_length, Easing.OutQuint);
|
|
|
|
|
this.FadeTo(1, transition_length, Easing.OutQuint);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-28 17:39:45 +08:00
|
|
|
|
public bool OnPressed(CatchAction action)
|
|
|
|
|
{
|
|
|
|
|
switch (action)
|
|
|
|
|
{
|
|
|
|
|
case CatchAction.MoveLeft:
|
|
|
|
|
currentDirection--;
|
|
|
|
|
return true;
|
|
|
|
|
case CatchAction.MoveRight:
|
|
|
|
|
currentDirection++;
|
|
|
|
|
return true;
|
|
|
|
|
case CatchAction.Dash:
|
|
|
|
|
Dashing = true;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool OnReleased(CatchAction action)
|
|
|
|
|
{
|
|
|
|
|
switch (action)
|
|
|
|
|
{
|
|
|
|
|
case CatchAction.MoveLeft:
|
|
|
|
|
currentDirection++;
|
|
|
|
|
return true;
|
|
|
|
|
case CatchAction.MoveRight:
|
|
|
|
|
currentDirection--;
|
|
|
|
|
return true;
|
|
|
|
|
case CatchAction.Dash:
|
|
|
|
|
Dashing = false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The relative space to cover in 1 millisecond. based on 1 game pixel per millisecond as in osu-stable.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public const double BASE_SPEED = 1.0 / 512;
|
|
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
|
{
|
|
|
|
|
base.Update();
|
|
|
|
|
|
|
|
|
|
if (currentDirection == 0) return;
|
|
|
|
|
|
2017-12-01 19:07:28 +08:00
|
|
|
|
var direction = Math.Sign(currentDirection);
|
|
|
|
|
|
2017-11-28 17:39:45 +08:00
|
|
|
|
double dashModifier = Dashing ? 1 : 0.5;
|
|
|
|
|
|
2017-12-01 19:07:28 +08:00
|
|
|
|
if (hyperDashModifier != 1 && (HyperDashDirection == 0 || direction == Math.Sign(HyperDashDirection)))
|
2017-12-01 18:24:48 +08:00
|
|
|
|
dashModifier = hyperDashModifier;
|
|
|
|
|
|
2017-12-01 19:07:28 +08:00
|
|
|
|
Scale = new Vector2(Math.Abs(Scale.X) * direction, Scale.Y);
|
|
|
|
|
X = (float)MathHelper.Clamp(X + direction * Clock.ElapsedFrameTime * BASE_SPEED * dashModifier, 0, 1);
|
2017-11-28 17:39:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 17:13:59 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Drop any fruit off the plate.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Drop()
|
|
|
|
|
{
|
|
|
|
|
var fruit = caughtFruit.ToArray();
|
|
|
|
|
|
|
|
|
|
foreach (var f in fruit)
|
|
|
|
|
{
|
|
|
|
|
if (ExplodingFruitTarget != null)
|
|
|
|
|
{
|
|
|
|
|
f.Anchor = Anchor.TopLeft;
|
|
|
|
|
f.Position = caughtFruit.ToSpaceOfOtherDrawable(f.DrawPosition, ExplodingFruitTarget);
|
|
|
|
|
|
|
|
|
|
caughtFruit.Remove(f);
|
|
|
|
|
|
|
|
|
|
ExplodingFruitTarget.Add(f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
f.MoveToY(f.Y + 75, 750, Easing.InSine);
|
|
|
|
|
f.FadeOut(750);
|
|
|
|
|
f.Expire();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Explode any fruit off the plate.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Explode()
|
2017-11-28 17:39:45 +08:00
|
|
|
|
{
|
|
|
|
|
var fruit = caughtFruit.ToArray();
|
|
|
|
|
|
|
|
|
|
foreach (var f in fruit)
|
|
|
|
|
{
|
|
|
|
|
var originalX = f.X * Scale.X;
|
|
|
|
|
|
|
|
|
|
if (ExplodingFruitTarget != null)
|
|
|
|
|
{
|
|
|
|
|
f.Anchor = Anchor.TopLeft;
|
|
|
|
|
f.Position = caughtFruit.ToSpaceOfOtherDrawable(f.DrawPosition, ExplodingFruitTarget);
|
|
|
|
|
|
|
|
|
|
caughtFruit.Remove(f);
|
|
|
|
|
|
|
|
|
|
ExplodingFruitTarget.Add(f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
f.MoveToY(f.Y - 50, 250, Easing.OutSine)
|
|
|
|
|
.Then()
|
|
|
|
|
.MoveToY(f.Y + 50, 500, Easing.InSine);
|
|
|
|
|
|
|
|
|
|
f.MoveToX(f.X + originalX * 6, 1000);
|
|
|
|
|
f.FadeOut(750);
|
|
|
|
|
|
|
|
|
|
f.Expire();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|