public void OnTriggerEnter(Collider other) { PlayerCharacter player = other.GetComponent <PlayerCharacter>(); if (player) { if (player.enabled) { player.Die(); } } AICharacter ai = other.GetComponent <AICharacter>(); if (ai) { if (ai.enabled) { ai.Die(); } } if (other.transform.tag == "Slicable" && !other.isTrigger) { //planeDummy.eulerAngles = Vector3.zero; SliceObject(other.GetComponentInChildren <Renderer>().gameObject, cuttingPlane); /* if ( ) * { * if (other.transform.parent != null) * other.transform.parent.gameObject.SetActive(false); * }*/ } }
public void OnCollisionEnter(Collision collision) { PlayerCharacter player = collision.collider.GetComponent <PlayerCharacter>(); if (player) { if (player.enabled) { player.Die(); } } AICharacter ai = collision.collider.GetComponent <AICharacter>(); if (ai) { if (ai.enabled) { ai.Die(); } } }