12345678910111213141516171819202122232425262728 |
- import {Trait} from "../Entity.js";
-
- export default class Collider extends Trait {
- constructor(entity) {
- super(entity, "collider");
-
- this.collides = false;
- this.entities = [];
- this.structures = [];
- this.structureBounds = [];
- }
-
- collideEntity(e) {
- this.collides = true;
- this.entities.push(e);
- }
-
- collideStructure(s) {
- this.collides = true;
- this.structures.push(s);
- }
-
- postUpdate() {
- this.entities.length = 0;
- this.structures.length = 0;
- this.collides = false;
- }
- }
|