Add basic multiplayer
This commit is contained in:
parent
0f0a1eaf67
commit
46a48e7c15
113 changed files with 1362 additions and 754 deletions
20
backend/src/physics/containers/bounding-box-list.ts
Normal file
20
backend/src/physics/containers/bounding-box-list.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { BoundingBoxBase } from '../bounds/bounding-box-base';
|
||||
|
||||
export class BoundingBoxList {
|
||||
constructor(private boundingBoxes: Array<BoundingBoxBase> = []) {}
|
||||
|
||||
public insert(box: BoundingBoxBase) {
|
||||
this.boundingBoxes.push(box);
|
||||
}
|
||||
|
||||
public remove(box: BoundingBoxBase) {
|
||||
this.boundingBoxes.splice(
|
||||
this.boundingBoxes.findIndex((i) => i === box),
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
public findIntersecting(box: BoundingBoxBase): Array<BoundingBoxBase> {
|
||||
return this.boundingBoxes.filter((b) => b.intersects(box));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue