示例#1
0
    private void InitDepth()
    {
        List <TechNode> children = new List <TechNode>();

        foreach (Transform child in transform)
        {
            TechNode node = child.GetComponent <TechNode>();
            if (node)
            {
                node.InitDepth();
                children.Add(node);
            }
        }
        m_children = children.ToArray();

        m_depth = 0;
        for (int i = 0; i < m_children.Length; i++)
        {
            m_depth = Mathf.Max(m_depth, m_children[i].depth + 1);
        }
    }