private void HandleShootSpecialWeapon() { if (input.IsSpecialFirePressed() && !SpecialWeaponCharging && !PrimaryWeaponCharging && SpecialWeapon != null) { SpecialWeaponCharging = true; SpeedSpecialWeapon = 0.5f; } if (SpecialWeaponCharging) { var maxSpeed = SpecialWeapon.MaxSpeed; if (SpeedSpecialWeapon != maxSpeed) { SpeedSpecialWeapon += Time.deltaTime * SpecialWeapon.SpeedStep; // apply charging animation var width = SpeedSpecialWeapon / maxSpeed * 0.6f; SpriteCharge.size = new Vector2(width, SpriteCharge.size.y); if (SpeedSpecialWeapon > maxSpeed) { SpeedSpecialWeapon = maxSpeed; } } } if (input.IsSpecialFireReleased() && SpecialWeaponCharging) { SpecialWeaponCharging = false; SpriteCharge.size = new Vector2(0, SpriteCharge.size.y); // throw special weapon var throwable = Instantiate(SpecialWeapon); throwable.gameObject.transform.position = Position.position + ThrowOffset; throwable.Thrower = Player; throwable.SetSpeed(ShootingDirection, SpeedSpecialWeapon); animator.Play("throw"); SoundManager.instance.playThrowIt(); SpecialWeapon = null; } }