hasSubgoals 是 CompositeGoal 类的一个属性,用于检查当前目标是否包含子目标。
CompositeGoal 是 Goal 的一种扩展,它是一个由多个子目标组成的复合目标。每个子目标都是一个独立的 Goal,并且可以有不同的优先级和状态。
CompositeGoal.hasSubgoals()
const parentGoal = new CompositeGoal();
const childGoal1 = new Goal();
const childGoal2 = new Goal();
parentGoal.addSubgoal(childGoal1);
parentGoal.addSubgoal(childGoal2);
console.log(parentGoal.hasSubgoals()); // 输出: true