예제 #1
0
    // =================================================================================================================================
    // Check if the hierarchy has changed since the last check
    protected bool CheckHierarchyChanges()
    {
        if (!MonitorHierarchy)
        {
            return(false);
        }

        GameObject[] tmpHierarchy = GameObjectBoundaries.GetAllChilds(transform.gameObject).ToArray();

        if (lastHierarchy.Length != tmpHierarchy.Length)
        {
            BuildStructure();
            lastHierarchy = tmpHierarchy;
            return(true);
        }

        for (int i = 0; i < tmpHierarchy.Length; i++)
        {
            if (lastHierarchy [i] != tmpHierarchy [i])
            {
                BuildStructure();
                lastHierarchy = tmpHierarchy;
                return(true);
            }
        }

        return(false);
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        GameObject go = GameObject.Find("Tank");

        GameObjectBoundaries component = go.GetComponent <GameObjectBoundaries> ();

        Bounds bounds = component.GetBounds(true);

        print(bounds);
    }
예제 #3
0
    // ===================================
    // ...
    protected void UpdateChildren()
    {
        lastHierarchy = GameObjectBoundaries.GetAllChilds(transform.gameObject).ToArray();

        for (int i = 0; i < lastHierarchy.Length; i++)
        {
            if (lastHierarchy [i] != gameObject)
            {
                MetaCgoChild tmpChildComp = lastHierarchy [i].GetComponent <MetaCgoChild> ();

                if (tmpChildComp == null)
                {
                    tmpChildComp = lastHierarchy [i].AddComponent <MetaCgoChild> ();
                    tmpChildComp.MonitorPosition = MonitorChildrenPosition;
                    tmpChildComp.MonitorRotation = MonitorChildrenRotation;
                    tmpChildComp.MonitorScale    = MonitorChildrenScale;
                    tmpChildComp.UltimateParent  = this;
                }
            }
        }
    }