active()
方法用于检查并确定是否完成当前CompositeGoal的活动。
在CompositeGoal中,如果任一子目标没有完成,则CompositeGoal处于活动状态。当所有子目标均已完成时,CompositeGoal被视为完成。
active()
true
代表活动状态false
代表已完成状态const yuka = new Yuka();
const goal1 = ... // 创建子目标1
const goal2 = ... // 创建子目标2
const compositeGoal = new CompositeGoal();
compositeGoal.addChild( goal1 );
compositeGoal.addChild( goal2 );
...
if ( compositeGoal.active() ) {
// CompositeGoal 处于活动状态
} else {
// CompositeGoal 已完成
}
无
Yuka.js团队