Beispiel #1
0
 public CodeBlockObjectMesh GetCodeBlockObjectMesh()
 {
     if (codeBlockObjectMesh == null)
     {
         codeBlockObjectMesh = gameObject.GetComponentInChildrenOnlyDepthOne <CodeBlockObjectMesh>();
     }
     return(codeBlockObjectMesh);
 }
Beispiel #2
0
 public CodeBlockObjectMesh GetCodeBlockObjectMesh()
 {
     if (codeBlockObjectMesh == null)
     {
         codeBlockObjectMesh = GetComponentInChildren <CodeBlockObjectMesh>();
     }
     return(codeBlockObjectMesh);
 }
        private void ResizeArgRight()
        {
            Vector3             rescale    = origScaleArgRight;
            Vector3             reposition = origPositionArgRight;
            CodeBlockObjectMesh obMesh     = GetMyCodeBlock().GetArgAsCodeBlockAt(1)?.GetCodeBlockObjectMesh();

            if (obMesh != null)
            {
                rescale.x    = obMesh.GetBlockHorizontalSize();
                reposition.x = reposition.x + (rescale.x - 0.5f) / 2.0f;
            }
            argRight.localPosition = reposition;
            argRight.localScale    = rescale;
        }
Beispiel #4
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.MyCodeBlock;
            }
            // StartCodeBlock is indestructible
            if (result == StartCodeBlock.instance)
            {
                result = null;
            }
            return(result);
        }
Beispiel #5
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.MyCodeBlock.name);
            }
            PressableButtonHoloLens2 pbh2 = go.GetComponentInParent <PressableButtonHoloLens2>();

            if (pbh2 != null)
            {
                return(pbh2.name);
            }

            return(go.name);
        }