add missing build method to designation

bottom-bar
Ivory 2023-01-10 04:04:06 -05:00
parent 76fa3b0f8a
commit 18f4a33038
1 changed files with 12 additions and 0 deletions

View File

@ -21,6 +21,18 @@ public abstract class Designation<T extends ISelectable> extends GameObject impl
} }
} }
@Override
@SuppressWarnings("unchecked")
public void buildAt(int x, int y) {
Class<T> type = getType();
List<T> things = getAll(type);
for(ISelectable thing : things) {
Vector4f box = thing.getWorldBox();
if(rectanglesIntersect(x, y, x + 1, y + 1, box.x, box.y, box.z, box.w))
designate((T) thing);
}
}
public boolean rectanglesIntersect( public boolean rectanglesIntersect(
float minAx, float minAy, float maxAx, float maxAy, float minAx, float minAy, float maxAx, float maxAy,
float minBx, float minBy, float maxBx, float maxBy ) { float minBx, float minBy, float maxBx, float maxBy ) {