public bool IsInBounds(Entity entity, int x, int y) { PixelRect hitbox = entity.GetOffsetHitbox(x, y); if (hitbox.xMax >= PixelScreen.shared.GetScreenWidth() || hitbox.xMin < 0 || hitbox.yMax >= PixelScreen.shared.GetScreenHeight() || hitbox.yMin < 0) { return(false); } return(true); }
public Entity Collide(Entity entity, string tag, int x, int y) { foreach(Entity other in _entities) { if(!other.tags.Contains(tag) || !other.collideable || other == entity) continue; if(entity.GetOffsetHitbox(x, y).Overlaps(other.offsetHitbox)) { return other; } } return null; }
public Entity Collide(Entity entity, string tag, int x, int y) { foreach (Entity other in _entities) { if (!other.tags.Contains(tag) || !other.collideable || other == entity) { continue; } if (entity.GetOffsetHitbox(x, y).Overlaps(other.offsetHitbox)) { return(other); } } return(null); }
public List <Entity> CollideWithAll(Entity entity, string tag, int x, int y) { List <Entity> entities = new List <Entity>(); foreach (Entity other in _entities) { if (!other.tags.Contains(tag) || !other.collideable || other == entity) { continue; } if (entity.GetOffsetHitbox(x, y).Overlaps(other.offsetHitbox)) { entities.Add(other); } } return(entities); }
public List<Entity> CollideWithAll(Entity entity, string tag, int x, int y) { List<Entity> entities = new List<Entity>(); foreach(Entity other in _entities) { if(!other.tags.Contains(tag) || !other.collideable || other == entity) continue; if(entity.GetOffsetHitbox(x, y).Overlaps(other.offsetHitbox)) { entities.Add(other); } } return entities; }
public bool IsInBounds(Entity entity, int x, int y) { PixelRect hitbox = entity.GetOffsetHitbox(x, y); if(hitbox.xMax >= PixelScreen.shared.GetScreenWidth() || hitbox.xMin < 0 || hitbox.yMax >= PixelScreen.shared.GetScreenHeight() || hitbox.yMin < 0) { return false; } return true; }