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) => {
|
||||
const areaToInform = this.entity.areaToInform;
|
||||
const room = this.entity.room;
|
||||
const visibleEntities = room.visibleEntities(areaToInform);
|
||||
return -1 !== visibleEntities.indexOf(entity);
|
||||
return Rectangle.isTouching(
|
||||
Rectangle.translated(
|
||||
areaToInform,
|
||||
Vector.scale(Rectangle.size(areaToInform), -0.5),
|
||||
),
|
||||
entity.visibleAabb
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user