private void OnTriggerEnter(Collider other) { if (other.GetComponent <HPModule>() == player) { player.GetHit(Damage, KnockBackForce, transform.position, AttackEffect.DamageSource.Physical); } Instantiate(hitParticles, transform.position, Quaternion.identity); Destroy(gameObject); }
private IEnumerator CheckAttack() { Ray ray = new Ray(transform.position, Player.transform.position - transform.position); if (Physics.Raycast(ray, AttackRange, playerLayer)) { yield return(StartCoroutine(AnimateAttack())); if (Physics.Raycast(ray, AttackRange, playerLayer)) { Player.GetHit(Damage, KnockBackForce, transform.position, AttackEffect.DamageSource.Physical); } yield return(new WaitForSeconds(Cooldown)); } }
private void DamageTarget() { target.GetHit(Damage, 0f, Vector3.zero, AttackEffect.DamageSource.Fire); }