Beispiel #1
0
 private void Update()
 {
     if (fighter.GetCurrentSpell() == null)
     {
         return;
     }
     if (fighter.GetCurrentSpell().GetSpellType() != 0 || boxCollider.enabled == false)
     {
         return;
     }
     if (Time.time > nextDamageTime)
     {
         nextDamageTime = Time.time + damageRate;
         foreach (Collider other in collList)
         {
             other.gameObject.transform.GetComponent <IEnemy>().SetHitVelocity(player.transform.forward, hitPower);
             other.gameObject.transform.GetComponent <Health>().DecreaseHealth(damage);
         }
     }
 }
 private void OnTriggerEnter(Collider other)
 {
     if (fighter.GetCurrentSpell().GetSpellType() != 1)
     {
         return;
     }
     if (other.gameObject.CompareTag("Enemy"))
     {
         Vector3 dir = other.gameObject.transform.position - transform.position;
         other.gameObject.transform.GetComponent <IEnemy>().SetHitVelocity(dir.normalized, hitPower);
         other.gameObject.transform.GetComponent <Health>().DecreaseHealth(damage);
     }
 }