private RectangleF CheckTargetBox(CollisionBox hitbox, RectangleF boundBox, IEntity entity, CollisionComponent coll, CollisionBox targetBox) { RectangleF rect = targetBox.BoxAt(coll.PositionSrc.Position); if (boundBox.IntersectsWith(rect)) { coll.Touch(hitbox, targetBox); Touch(targetBox, hitbox); CollideWith(entity, hitbox, targetBox); } return boundBox; }
private void CheckEnvironmentTile(List<MapSquare> hitSquares, CollisionBox hitbox, RectangleF hitRect, MapSquare tile, ref PointF offset) { if (hitbox.EnvironmentCollisions(PositionSrc.Position, tile, ref offset)) { hitSquares.Add(tile); if (hitbox.PushAway) PositionSrc.Offset(offset.X, offset.Y); } else if (hitRect.IntersectsWith(tile.BoundBox)) { hitSquares.Add(tile); } }