void OnTriggerExit(Collider other) { GameObject otherGO = other.transform.root.gameObject; blockHandler = otherGO.GetComponent <ObjectMouvement>(); if (blockHandler) { blockHandler.DisableDrop(); blockHandler = null; } }
void OnTriggerEnter(Collider other) { GameObject otherGO = other.transform.root.gameObject; blockHandler = otherGO.GetComponent <ObjectMouvement>(); if (blockHandler) { PhaseType phaseType = partyManager.GetCurrentPhase(); Transform playerZoneFocus = partyManager.playerZone.transform.GetChild(1); Transform consideredFocus = gameObject.transform.GetChild(1); if ((phaseType == PhaseType.Build && playerZoneFocus.position.Equals(consideredFocus.position)) || (phaseType == PhaseType.Destruct && !playerZoneFocus.position.Equals(consideredFocus.position))) { blockHandler.EnableDrop(); } } }