예제 #1
0
        public static Region Find(Point3D p, Map map)
        {
            if (map == null)
            {
                return(Map.Internal.DefaultRegion);
            }

            Sector sector = map.GetSector(p);
            var    list   = sector.RegionRects;

            for (int i = 0; i < list.Count; ++i)
            {
                RegionRect regRect = list[i];

                if (regRect.Contains(p))
                {
                    return(regRect.Region);
                }
            }

            return(map.DefaultRegion);
        }
예제 #2
0
        public void OnLeave(Region region)
        {
            if (m_RegionRects != null)
            {
                for (int i = m_RegionRects.Count - 1; i >= 0; i--)
                {
                    RegionRect regRect = m_RegionRects[i];

                    if (regRect.Region == region)
                    {
                        m_RegionRects.RemoveAt(i);
                    }
                }

                if (m_RegionRects.Count == 0)
                {
                    m_RegionRects = null;
                }
            }

            UpdateMobileRegions();
        }
예제 #3
0
파일: Sector.cs 프로젝트: cookiehhh/Cshape
        public void OnEnter(Region r, Rectangle3D rect)
        {
            if (m_RegionRects == null)
            {
                m_RegionRects = new List <RegionRect>();
            }

            RegionRect regRect = new RegionRect(r, rect);

            m_RegionRects.Add(regRect);
            m_RegionRects.Sort();

            if (m_Mobiles != null && m_Mobiles.Count > 0)
            {
                List <Mobile> list = new List <Mobile>(m_Mobiles);

                for (int i = 0; i < list.Count; ++i)
                {
                    list[i].UpdateRegion();
                }
            }
        }
예제 #4
0
 public static bool Contains(this RegionRect r, Point3D p)
 {
     return(r.Rect.Contains(p));
 }
예제 #5
0
 public static bool Contains(this RegionRect r, Point3D p, Map m)
 {
     return(r.Region.Map == m && Contains(r, p));
 }