added isActivatable() method to implement through interface
This commit is contained in:
parent
2322f5f76d
commit
989897cb01
8 changed files with 32 additions and 247 deletions
|
@ -1,6 +1,7 @@
|
|||
|
||||
export interface ActivatableInterface {
|
||||
readonly activationRadius: number;
|
||||
isActivatable: () => boolean;
|
||||
activate: () => void;
|
||||
getPosition: () => { x: number, y: number };
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ export class ActivatablesManager {
|
|||
let closestObject: ActivatableInterface | undefined = undefined;
|
||||
|
||||
for (const [object, distance] of this.activatableObjectsDistances.entries()) {
|
||||
if (object.activationRadius > distance && shortestDistance > distance) {
|
||||
if (object.isActivatable() && object.activationRadius > distance && shortestDistance > distance) {
|
||||
shortestDistance = distance;
|
||||
closestObject = object;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue