示例#1
0
 private void DealAttack(Bouncer enemy)
 {
     //Check if the attack is parried or lands
     //Parried
     if (enemy.attacking && Vector3.Angle(enemy.gameObject.transform.forward, transform.position - enemy.gameObject.transform.position) <= gameController.gameSettings.attackAngle)
     {
         //IF statement to ensure only a single bouncer plays the parry effects
         if (currentAttackPower > enemy.currentAttackPower)
         {
             //Play parry effects
             Debug.Log("Parried");
             audioSource.PlayOneShot(gameController.gameSettings.parrySound);
             Vector3 connectionPoint = (transform.position + enemy.gameObject.transform.position) / 2f;
             connectionPoint.y += gameController.gameSettings.boundsRadius;
             Instantiate(gameController.gameSettings.parryParticlesPrefab, connectionPoint, gameController.gameSettings.parryParticlesPrefab.transform.rotation);
         }
     }
     //Lands
     else
     {
         enemy.ReceiveAttack(GetAttackDamage(currentAttackPower));
         Debug.Log(gameObject.name + " landed a hit on " + enemy.gameObject.name);
     }
 }