コード例 #1
0
 public void Attack()
 {
     if (attackTimer >= attackSpeed)
     {
         anim.SetBool("InCombat", true);
         transform.LookAt(target.transform.position);
         anim.SetTrigger("Hit");
         // Damage dealt to the enemy is a lot less if that enemy is in cover. See Cover System
         if (MapClass.InCover(gameObject, target))
         {
             Debug.Log("In Cover!");
             target.GetComponent <Health> ().TakeDamage(attackDamage / 8, this.gameObject);
         }
         else
         {
             target.GetComponent <Health> ().TakeDamage(attackDamage, this.gameObject);
         }
         attackTimer = 0f;
     }
 }