public virtual bool Contains(Point3D p) { //possibly use a binary search instead, to increase speed? if (m_Coords == null) { return(false); } for (int i = 0; i < m_Coords.Count; ++i) { object obj = m_Coords[i]; if (obj is Rectangle3D) { Rectangle3D r3d = (Rectangle3D)obj; if (r3d.Contains(p)) { return(true); } } else if (obj is Rectangle2D) { Rectangle2D r2d = (Rectangle2D)obj; if (r2d.Contains(p) && p.m_Z >= m_MinZ && p.m_Z <= m_MaxZ) { return(true); } } } return(false); }
public static IEnumerable <TEntity> FindEntities <TEntity>(this Rectangle3D r, Map m) where TEntity : IEntity { IPooledEnumerable i = m.GetObjectsInBounds(r.ToRectangle2D()); foreach (TEntity e in i.OfType <TEntity>().Where(o => r.Contains(o))) { yield return(e); } i.Free(); }
public bool Contains(Point3D p) { for (int i = 0; i < m_Area.Length; i++) { Rectangle3D rect = m_Area[i]; if (rect.Contains(p)) { return(true); } } return(false); }
public static IEnumerable <TEntity> FindEntities <TEntity>(this Rectangle3D r, Map m) where TEntity : IEntity { if (m == null || m == Map.Internal) { yield break; } var o = m.GetObjectsInBounds(r.ToRectangle2D()); foreach (var e in o.OfType <TEntity>().Where(e => e.Map == m && r.Contains(e))) { yield return(e); } o.Free(); }
public bool Contains(Point3D loc) => m_Rect.Contains(loc);
public bool Contains(Point3D loc) { return(m_Rect.Contains(loc)); }
public static IEnumerable <TEntity> FindEntities <TEntity>(this Rectangle3D r, Map m) where TEntity : IEntity { if (m == null || m == Map.Internal) { yield break; } IPooledEnumerable i = m.GetObjectsInBounds(r.ToRectangle2D()); foreach (TEntity e in i.OfType <TEntity>().Where(o => o != null && o.Map == m && r.Contains(o))) { yield return(e); } i.Free(); }
private bool ArenaContainsMatch(Rectangle3D arena, Match match) { for(int i = 0; i < match.Attackers.Count; ++i) //Loop through attackers { if(arena.Contains(match.Attackers[i].Location)) return true; } for(int i = 0; i < match.Defenders.Count; ++i) //Loop through defenders { if(arena.Contains(match.Defenders[i].Location)) return true; } return false; }