示例#1
0
 public void Update()
 {
     if (m_spaceManager.IsHigh(m_bounds))
     {
         if (m_fsm.State == State.Release)
         {
             m_fsm.ChangeState(State.Low);
         }
         m_fsm.ChangeState(State.High);
     }
     else
     {
         m_fsm.ChangeState(State.Low);
     }
 }
示例#2
0
        public void Update(float lodDistance)
        {
            m_distance = m_spaceManager.GetDistanceSqure(m_bounds) - m_boundsLength;

            //Change state if a change to another state is needed immediately after changing the state.
            var beforeState = m_fsm.CurrentState;

            do
            {
                beforeState = m_fsm.CurrentState;
                if (m_fsm.LastState != State.Release)
                {
                    if (m_spaceManager.IsHigh(lodDistance, m_bounds))
                    {
                        //if isVisible is false, it loaded from parent but not showing.
                        //We have to wait for showing after then, change state to high.
                        if (m_fsm.CurrentState == State.Low &&
                            m_isVisible == true)
                        {
                            m_fsm.ChangeState(State.High);
                        }
                    }
                    else
                    {
                        m_fsm.ChangeState(State.Low);
                    }
                }

                m_fsm.Update();
            } while (beforeState != m_fsm.CurrentState);

            UpdateVisible();

            for (int i = 0; i < m_childTreeNodeIds.Count; ++i)
            {
                var childTreeNode = m_container.Get(m_childTreeNodeIds[i]);
                childTreeNode.Update(lodDistance);
            }
        }