void FlingBall()
{
if(ball != null && !Dead && !parrying) {
flungAtCharge = charge;
float relativeCharge = (flungAtCharge - minCharge) / (maxCharge - minCharge);
if(relativeCharge > 0.99) {
ball.throwSound = Assets.getSound("chargedThrow").CreateInstance();
ball.throwSound.Play();
ball.throwSound.Pan = panPosition();
ball.throwSound.Volume = CHARGED_THROW_VOLUME;
} else {
ball.throwSound = Assets.getSound("throw1").CreateInstance();
ball.throwSound.Play();
ball.throwSound.Pan = panPosition();
ball.throwSound.Pitch = -0.3f + relativeCharge;
ball.throwSound.Volume = 0.75f + (relativeCharge / 4f);
}
Vector2 flingDirection = Vector2.Normalize(retical.Direction);
ball.Fling(flingDirection.X, flingDirection.Y, charge);
ball = null;
play("throw");
throwing = true;
animation.reset();
animation.FPS = MIN_THROW_FPS + ((charge / maxCharge) *
(MAX_THROW_FPS - MIN_THROW_FPS));
if(charge > DROP_CHARGE) {
G.DoForSeconds(0.2f,
() => GamePad.SetVibration(playerIndex,
(flungAtCharge - minCharge) / (maxCharge - minCharge), 0),
() => GamePad.SetVibration(playerIndex, 0, 0));
}
}
}