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); }
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(); }
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(); } } }
public static bool Contains(this RegionRect r, Point3D p) { return(r.Rect.Contains(p)); }
public static bool Contains(this RegionRect r, Point3D p, Map m) { return(r.Region.Map == m && Contains(r, p)); }