public string OnCollideCB; // send this event, when touch happens public void OnCollisionEnter(Collision col) { if (GetRecipient() == col.gameObject) { GameObject go = col.gameObject; isCollectible isCol = GetComponent <isCollectible>(); if (isCol != null) { isCol.SetRecipient(col.gameObject); } // send a response if (OnCollideCB != "") { SendMessage(OnCollideCB); } //this.enabled = false; GetComponent <BoxCollider>().enabled = false; } }
public string OnTouchCB; // send this event, when touch happens public void OnTriggerEnter(Collider other) { if (this.enabled == true) { GameObject go = other.gameObject; //isConsumable isC = GetComponent<isConsumable> (); //if (isC != null) //{ // isC.SetRecipient (other.gameObject); //} //isEquipable isEq = GetComponent<isEquipable> (); //if (isEq != null) //{ // isEq.SetRecipient (other.gameObject); //} isCollectible isCol = GetComponent <isCollectible>(); if (isCol != null) { isCol.SetRecipient(other.gameObject); } // send a response if (OnTouchCB != "") { SendMessage(OnTouchCB); } //this.enabled = false; GetComponent <BoxCollider>().enabled = false; this.enabled = false; } }