fix: more efficient seesEntity
This commit is contained in:
parent
9fa44709b9
commit
dc9a26268c
|
@ -268,9 +268,13 @@ export class Informed extends decorate(Trait) {
|
||||||
|
|
||||||
seesEntity: (entity) => {
|
seesEntity: (entity) => {
|
||||||
const areaToInform = this.entity.areaToInform;
|
const areaToInform = this.entity.areaToInform;
|
||||||
const room = this.entity.room;
|
return Rectangle.isTouching(
|
||||||
const visibleEntities = room.visibleEntities(areaToInform);
|
Rectangle.translated(
|
||||||
return -1 !== visibleEntities.indexOf(entity);
|
areaToInform,
|
||||||
|
Vector.scale(Rectangle.size(areaToInform), -0.5),
|
||||||
|
),
|
||||||
|
entity.visibleAabb
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user