void OnTriggerExit(Collider other) { //If the other is the occupator, ... if(occupator != null && occupator != other.gameObject.GetComponent<CylinderBehaviour>()) { //Unbind position. occupator.hole = null; //The hole no longer is occupied. occupator = null; } }
void OnTriggerExit(Collider other) { if (other.tag.Equals("Cylinder")) { CylinderBehaviour cb = other.transform.parent.GetComponent<CylinderBehaviour>(); if(cb == cylinder) { cylinder = null; } } }
void OnTriggerEnter(Collider other) { //If the other collider is a cylinder, ... if(other.gameObject.GetComponent<CylinderBehaviour>() != null) { //If the hole is not occupied, ... if(occupator == null) { //The hole becomes occupied. occupator = other.gameObject.GetComponent<CylinderBehaviour>(); //Bind position. occupator.hole = this; } } }
void OnTriggerEnter(Collider other) { if(other.tag.Equals("Cylinder") && cylinder == null) { cylinder = other.transform.parent.GetComponent<CylinderBehaviour>(); } }