Goal 是 Yuka.js 中的一个类,用于表示一种行动目标。Goal 对象需要一个 Owner (所有者)来监督行动的进度。
owner: Entity
- Goal 的所有者 Entity 对象。setOwner(owner: Entity): this
- 设置 Goal 的所有者 Entity。reset(): void
- 重置 Goal 的状态。import { Entity, Goal } from 'yuka';
const owner = new Entity();
const goal = new Goal(owner);
console.log(goal.owner === owner); // true
const newOwner = new Entity();
goal.setOwner(newOwner);
console.log(goal.owner === newOwner); // true
goal.reset();