// Update is called once per frame private void OnTriggerStay(Collider other) { if (healthScript != null) { bool hitSuccess = healthScript.HandleHit(attackDamage); if (hitSuccess) { healthScript.KnockbackPlayer(transform.position); } } }
private void OnTriggerEnter(Collider other) { DungeonPlayerHealth target = other.GetComponent <DungeonPlayerHealth>(); if (target != null) { target.HandleHit(damage); Destroy(gameObject); } //To Handle if (other.gameObject.tag == "Environment") { Destroy(gameObject); } }