//When player takes damage public void TakeHit(Hit hit) { if (!Health.invincible) { Health.TakeHit(hit); } }
public void CheckAttack() { RaycastHit hit; if (Physics.Raycast(parent.transform.position, parent.transform.forward, out hit, knife.bladeLength)) { ig_Health target = hit.collider.gameObject.GetComponent <ig_Health>(); Hit knifeHit = new Hit(gameObject, target.gameObject, knife.damage); if (target != null) { target.TakeHit(knifeHit); } } }