protected virtual void AttackTarget() { targetEntity.TakeDamage(AttackPower, ElementalResistances.PHYSICAL); attackTimer = 1.0f / AttackSpeed; if (targetEntity.CurrentHealth <= 0) { targetEntity = null; } }
void OnTriggerEnter2D(Collider2D other) { if (EnemyProjectile && (other.transform.tag == "Player" || other.transform.tag == "Minion" || other.transform.tag == "Wall")) { if (other.transform.tag != "Wall") { other.GetComponent <AttackableEntity>().TakeDamage(damageValue, damageType); } Destroy(gameObject); } else if (!EnemyProjectile) { AttackableEntity otherEntity = other.GetComponent <AttackableEntity>(); if (otherEntity != null) { otherEntity.TakeDamage(damageValue, damageType); Destroy(gameObject); } } }