Exemple #1
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);
        }
Exemple #2
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);
        }