} // End of Start // When the object hits the object, run the check. void OnTriggerEnter(Collider other) { if (lockCheckFunction == false) { CreatureIdentity id = other.gameObject.GetComponent<CreatureIdentity>(); if (GetNumber() == id.Number) CorrectAnswer(); else IncorrectAnswer(); } // Destroy the game object when they activate this trigger Destroy(other.gameObject); } // End of OnTriggerEnter
void OnTriggerEnter(Collider other) { if (other.tag == "Ladder") { isClimbing = true; isWalking = false; } else if (other.tag == "ForwardEnabler") { id = gameObject.GetComponent <CreatureIdentity>(); Debug.Log("Hit: " + id.Number.ToString()); isClimbing = false; isWalking = true; } else if (other.tag == "exit") { //exit code } }