29 lines
718 B
JavaScript
29 lines
718 B
JavaScript
import { GameObject } from "../../GameObject/GameObject";
|
|
import { Point2D } from "../../Utils/Math.utils";
|
|
import { NPCProto } from "../NPCProto/NPCProto";
|
|
/**
|
|
* NPCController defines NPC behavior. Many NPC can have same NPCController for the same behavior.
|
|
*/
|
|
export class NPCController extends GameObject
|
|
{
|
|
/**
|
|
* NPC controlled by this controller
|
|
* @type NPCProto
|
|
*/
|
|
controlledNPC = null;
|
|
|
|
constructor(tickAble = false)
|
|
{
|
|
super(tickAble);
|
|
}
|
|
|
|
/**
|
|
* moves NPC to position
|
|
* @param {Point2D} position
|
|
*/
|
|
moveTo(position)
|
|
{
|
|
this.controlledNPC.currentPosition = position;
|
|
this.controlledNPC.currentPosition = position;
|
|
}
|
|
}; |