Esempio n. 1
0
        public void Unregister()
        {
            if (!m_Registered)
            {
                return;
            }

            OnUnregister();

            m_Registered = false;

            if (m_Children.Count > 0)
            {
                Console.WriteLine("Warning: Unregistering region '{0}' with children", this);
            }

            if (m_Parent != null)
            {
                m_Parent.m_Children.Remove(this);
                m_Parent.OnChildRemoved(this);
            }

            m_Regions.Remove(this);

            m_Map.UnregisterRegion(this);

            if (m_Sectors != null)
            {
                for (int i = 0; i < m_Sectors.Length; i++)
                {
                    m_Sectors[i].OnLeave(this);
                }
            }

            m_Sectors = null;
        }