void OnManipulationEnd(ManipulationEventData call) { currentlyDraggingCBS = null; lastDraggedCBS = this; if (bestCandidateSnapCollider != null) { bestCandidateSnapCollider.DoSnapAction(bestCandidateSnapCollider.GetMyCodeBlock(), GetMyCodeBlock()); } else { // Remove when dragged away myCodeBlock.RemoveFromParentBlock(true); } mySnapColliders?.DisableAllCompatibleColliders(); GetCurSnapCollidersInContact().Clear(); AddSnapColliderInContact(null); }
void OnManipulationEnd(ManipulationEventData call) //let go of the block { currentlyDraggingCBS = null; lastDraggedCBS = this; if (bestCandidateSnapCollider != null) // within grey zone; SNAP ON { bestCandidateSnapCollider.DoSnapAction(bestCandidateSnapCollider.GetMyCodeBlock(), GetMyCodeBlock()); Block2TextConsoleManager.instance.UpdateConsoleOnSnap(); //refresh the Block2Text console when you ADD a block } else // outside of grey zone; SNAP OFF // Remove when dragged away { myCodeBlock.RemoveFromParentBlock(true); Block2TextConsoleManager.instance.UpdateConsoleOnSnap(); //refresh the Block2Text console when you REMOVE a block } mySnapColliders?.DisableAllCompatibleColliders(); GetCurSnapCollidersInContact().Clear(); AddSnapColliderInContact(null); }
public static CodeBlock GetDestructableCodeBlockObject(this GameObject go) { CodeBlock result = null; CodeBlockObjectMesh cbom = go.GetComponentInParent <CodeBlockObjectMesh>(); if (cbom != null) { result = cbom.GetMyCodeBlock(); } SnapCollider sc = go.GetComponent <SnapCollider>(); if (sc != null) { result = sc.GetMyCodeBlock(); } // StartCodeBlock is indestructible if (result == StartCodeBlock.instance) { result = null; } return(result); }
// Gameobject Extensions public static string TryGetNiceNameOfObjectForLogging(this GameObject go) { CodeBlockObjectMesh cbom = go.GetComponentInParent <CodeBlockObjectMesh>(); if (cbom != null) { return(cbom.GetMyCodeBlock().name); } SnapCollider sc = go.GetComponent <SnapCollider>(); if (sc != null) { return(sc.GetMyCodeBlock().name); } PressableButtonHoloLens2 pbh2 = go.GetComponentInParent <PressableButtonHoloLens2>(); if (pbh2 != null) { return(pbh2.name); } return(go.name); }