public void Explode(DrawableHitObject fruit) { var originalX = fruit.X * Scale.X; if (ExplodingFruitTarget != null) { fruit.Anchor = Anchor.TopLeft; fruit.Position = caughtFruit.ToSpaceOfOtherDrawable(fruit.DrawPosition, ExplodingFruitTarget); if (!caughtFruit.Remove(fruit)) { // we may have already been removed by a previous operation (due to the weird OnLoadComplete scheduling). // this avoids a crash on potentially attempting to Add a fruit to ExplodingFruitTarget twice. return; } ExplodingFruitTarget.Add(fruit); } fruit.MoveToY(fruit.Y - 50, 250, Easing.OutSine).Then().MoveToY(fruit.Y + 50, 500, Easing.InSine); fruit.MoveToX(fruit.X + originalX * 6, 1000); fruit.FadeOut(750); fruit.Expire(); }
public void Explode(DrawableHitObject fruit) { var originalX = fruit.X * Scale.X; if (ExplodingFruitTarget != null) { fruit.Anchor = Anchor.TopLeft; fruit.Position = caughtFruit.ToSpaceOfOtherDrawable(fruit.DrawPosition, ExplodingFruitTarget); caughtFruit.Remove(fruit); ExplodingFruitTarget.Add(fruit); } fruit.MoveToY(fruit.Y - 50, 250, Easing.OutSine) .Then() .MoveToY(fruit.Y + 50, 500, Easing.InSine); fruit.MoveToX(fruit.X + originalX * 6, 1000); fruit.FadeOut(750); fruit.Expire(); }