예제 #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;
        }
예제 #2
0
        public void Unregister()
        {
            if (!Registered)
            {
                return;
            }

            OnUnregister();

            Registered = false;

            if (Children.Count > 0)
            {
                log.Warning("Unregistering region '{0}' with children", this);
            }

            if (Parent != null)
            {
                Parent.Children.Remove(this);
                Parent.OnChildRemoved(this);
            }

            Regions.Remove(this);

            Map.UnregisterRegion(this);

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

            Sectors = null;
        }