/// <summary> /// Toggle the primary attack based on the input value /// </summary> /// <param name="value">Value of the input controller primary attack button state</param> protected override void OnPrimaryAttack(InputValue value) { if (AttackCooldown > 0) { return; } if (value.isPressed) { Interaction.StopInteract(); (Stats as PlayerStatsController).mana.Subtract(primaryAttackManaDepletion); _isPrimaryActive = true; Anim.SetBool("PrimaryAttack", true); StartCoroutine(AudioHelper.PlayAudio(WeaponAudio, primaryAttackWeaponSFX)); (Stats as PlayerStatsController).mana.PauseRegen(); Motor.ApplyMovementModifier(primaryAttackMovementModifier); } else { _isPrimaryActive = false; Anim.SetBool("PrimaryAttack", false); AudioHelper.StopAudio(WeaponAudio); (Stats as PlayerStatsController).mana.StartRegen(); Motor.ResetMovementModifier(); } }
/// <summary> /// Toggle the primary attack based on the input value /// </summary> /// <param name="value">Value of the input controller primary attack button state</param> protected override void OnPrimaryAttack(InputValue value) { if (AttackCooldown > 0 || (Stats as PlayerStatsController).mana.CurrentValue < primaryAttackManaDepletion) { return; } if (value.isPressed) { Interaction.StopInteract(); _isPrimaryCharging = true; _primaryChargeTime = 0f; Anim.SetBool("PrimaryAttack", true); StartCoroutine(AudioHelper.PlayAudioOverlap(WeaponAudio, primaryAttackChargeWeaponSFX)); // pause mana regeneration (Stats as PlayerStatsController).mana.PauseRegen(); Motor.ApplyMovementModifier(primaryAttackMovementModifier); } else if (_isPrimaryCharging) { _isPrimaryCharging = false; Anim.SetBool("PrimaryAttack", false); AudioHelper.StopAudio(WeaponAudio); StartCoroutine(AudioHelper.PlayAudioOverlap(WeaponAudio, primaryAttackReleaseWeaponSFX)); // resume mana regeneration (Stats as PlayerStatsController).mana.StartRegen(); Motor.ResetMovementModifier(); PrimaryAttack(); } }
/// <summary> /// Toggle the primary attack based on the input value /// </summary> /// <param name="value">Value of the input controller primary attack button state</param> protected override void OnPrimaryAttack(InputValue value) { if (AttackCooldown > 0) { return; } if (value.isPressed) { Interaction.StopInteract(); _isPrimaryCharging = true; _primaryChargeTime = 0f; Anim.SetBool("PrimaryAttack", true); StartCoroutine(AudioHelper.PlayAudioOverlap(WeaponAudio, primaryAttackChargeWeaponSFX)); Motor.ApplyMovementModifier(primaryAttackMovementModifier); } else if (_isPrimaryCharging) { ReleaseChargedAttack(); } }