public StaticEntity GetStaticEntityAtPosition(int x, int y) { if (!IsInBounds(x, y)) { return(EDGE_WALL_ENTITY); } var position = new IntVector2(x, y); if (StaticEntities.Contains(position)) { return(StaticEntities[position]); } return(null); }
public IEnumerable <Entity> GetEntitiesAtPosition(int x, int y) { if (!IsInBounds(x, y)) { return(null); } var position = new IntVector2(x, y); var entities = new List <Entity>(); if (StaticEntities.Contains(position)) { entities.Add(StaticEntities[position]); } entities.AddRange(DynamicEntities.Where(e => e.Position == position)); entities.AddRange(PlayerEntities.Where(e => e.Position == position)); return(entities); }