SentryComp
:The sentry component.
group Components
subgroup Component Types
direction
?: Vec2The direction the sentry is pointing to.
directionAngle
?: numberThe direction of the sentry as an angle in degrees.
fieldOfView
?: numberThe field of view of the sentry in degrees.
spotted
: GameObj<any>[]The objects spotted most recently.
onObjectsSpotted
(cb: (objects: GameObj[]) => void): KEventControllerAttaches an event handler which is called when objects of interest are spotted.
param cb- The event handler called when objects are spotted.
isWithinFieldOfView
(obj: GameObj<PosComp>, direction?: Vec2, fieldOfView?: number): booleanReturns true if the object is within the field of view.
param obj- The object to test.
param direction- The direction to look at.
param fieldOfView- The field of view in degrees.
hasLineOfSight
(obj: GameObj<PosComp>): booleanReturns true if there is a line of sight to the object.
param obj- The object to test.