예제 #1
0
        public void Initialize(HLODControllerBase controller, ISpaceManager spaceManager, HLODTreeNode parent)
        {
            for (int i = 0; i < m_childTreeNodeIds.Count; ++i)
            {
                var childTreeNode = m_container.Get(m_childTreeNodeIds[i]);
                childTreeNode.Initialize(controller, spaceManager, this);
            }

            //set to initialize state
            m_fsm.ChangeState(State.Release);

            m_fsm.RegisterIsReadyToEnterFunction(State.Release, IsReadyToEnterRelease);
            m_fsm.RegisterEnteredFunction(State.Release, OnEnteredRelease);

            m_fsm.RegisterEnteringFunction(State.Low, OnEnteringLow);
            m_fsm.RegisterIsReadyToEnterFunction(State.Low, IsReadyToEnterLow);
            m_fsm.RegisterEnteredFunction(State.Low, OnEnteredLow);
            m_fsm.RegisterExitedFunction(State.Low, OnExitedLow);

            m_fsm.RegisterEnteringFunction(State.High, OnEnteringHigh);
            m_fsm.RegisterIsReadyToEnterFunction(State.High, IsReadyToEnterHigh);
            m_fsm.RegisterEnteredFunction(State.High, OnEnteredHigh);
            m_fsm.RegisterExitedFunction(State.High, OnExitedHigh);

            m_controller   = controller;
            m_spaceManager = spaceManager;
            m_parent       = parent;

            m_isVisible          = true;
            m_isVisibleHierarchy = true;

            m_boundsLength = m_bounds.extents.x * m_bounds.extents.x + m_bounds.extents.z * m_bounds.extents.z;
        }
 public void Deactivate(HLODTreeNode node)
 {
     if (m_activeTreeNode.Remove(node) == true)
     {
         //Succeed to remove, that means the child also activated.
         //so, we should remove child own.
         if (node.ChildNodes != null)
         {
             for (int i = 0; i < node.ChildNodes.Count; ++i)
             {
                 Deactivate(node.ChildNodes[i]);
             }
         }
     }
 }
        public void Deactivate(HLODTreeNode node)
        {
            if (m_activeTreeNode.Remove(node) == true)
            {
                //Succeed to remove, that means the child also activated.
                //so, we should remove child own.
                if (node.GetChildTreeNodeCount() == 0)
                {
                    return;
                }

                for (int i = 0; i < node.GetChildTreeNodeCount(); ++i)
                {
                    Deactivate(node.GetChildTreeNode(i));
                }
            }
        }
 public void Activate(HLODTreeNode node)
 {
     m_activeTreeNode.Add(node);
 }