public virtual IEnumerator Launch(float powerLevel) { //stamina handling stamina.AdjustValue(-GetAttackDamage(powerLevel)); //Play sound audioSource.Play(); //Spawn particles trailParticles.SetActive(true); //apply force for launch and set attacking to true until the bouncer has slowed down sufficiently rigidbody.velocity = transform.forward * gameController.gameSettings.attackPowerScaler * powerLevel; attacking = true; while (rigidbody.velocity.magnitude != 0f) { if (rigidbody.velocity.magnitude < 0.3f) { rigidbody.velocity = Vector3.zero; } yield return(null); } currentAttackPower = 0f; attacking = false; //Despawn particles trailParticles.SetActive(false); //face the thing toward the camera again FaceCamera(); }
public virtual void ReceiveAttack(float attackDamage) { //Play hurt noise, particle effects, etc. here if (TakeDamageSequencer != null) { StopCoroutine(TakeDamageSequencer); } TakeDamageSequencer = TakeDamageSequence(); StartCoroutine(TakeDamageSequencer); //Apply damage health.AdjustValue(-attackDamage * gameController.gameDifficulty.wolfAttackDamageMultiplier); if (health.currentValue == 0f && alive) { Die(); } }