AABB
AlignmentBehavior
ArriveBehavior
AStar
BFS
BoundingSphere
BVH
BVHNode
Cell
CellSpacePartitioning
CohesionBehavior
CompositeGoal
ConvexHull
Corridor
CostTable
DFS
Dijkstra
Edge
EntityManager
EvadeBehavior
EventDispatcher
Behavior
FollowPathBehavior
FuzzyAND
FuzzyCompositeTerm
FuzzyFAIRLY
FuzzyModule
FuzzyOR
FuzzyRule
FuzzySet
FuzzyTerm
FuzzyVariable
FuzzyVERY
GameEntity
Goal
GoalEvaluator
Graph
GraphUtils
HalfEdge
HeuristicPolicyDijkstra
HeuristicPolicyEuclid
HeuristicPolicyEuclidSquared
HeuristicPolicyManhattan
InterposeBehavior
LeftSCurveFuzzySet
LeftShoulderFuzzySet
LineSegment
Logger
MathUtils
Matrix3
Matrix4
MemoryRecord
MemorySystem
MeshGeometry
MessageDispatcher
MovingEntity
NavEdge
NavMesh
NavMeshLoader
NavNode
Node
NormalDistFuzzySet
OBB
ObstacleAvoidanceBehavior
OffsetPursuitBehavior
OnPathBehavior
Path
Plane
Polygon
Polyhedron
PriorityQueue
PursuitBehavior
Quaternion
Ray
RectangleTriggerRegion
Regular
RightSCurveFuzzySet
RightShoulderFuzzySet
SAT
SeekBehavior
SeparationBehavior
SingletonFuzzySet
Smoother
SphericalTriggerRegion
State
StateMachine
SteeringBehavior
SteeringManager
Task
TaskQueue
Telegram
Think
Time
TriangularFuzzySet
Trigger
TriggerRegion
Vector3
Vehicle
Version
WanderBehavior

inactive

inactive 方法表示当前的 CompositeGoal 销毁,即组合目标已经不再处于激活状态。在任何一个 CompositeGoal 里,只要此方法被调用,都会立即停止其它需要完成的子目标,并所有它的附加操作。

语法

compositeGoal.inactive()

参数

返回值

示例

const compositeGoal = new Yuka.CompositeGoal();

// 添加两个计划
compositeGoal.addSubgoal( subgoal1 );
compositeGoal.addSubgoal( subgoal2 );

// 运行计划
compositeGoal.activate();

if ( someCondition ) {
  compositeGoal.inactive();
}

在上述示例中,如果 someCondition 为真,则 compositeGoal 将不再处于激活状态。任何正在执行的子目标都会立即停止,并取消它们的附加操作。

备注

不管是在完成所有子目标之前还是在任何子目标完成之前,都可以调用 inactive 方法。这个方法会在我们使用其他操作(如重新激活 CompositeGoal 或更换操作)之前彻底终止任何子目标的执行。