Beispiel #1
0
 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);
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        // 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);
        }