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

clearSubgoals

清除所有的子目标。

语法

think.clearSubgoals()

描述

clearSubgoals()方法用于清除所有子目标,即将所有子目标从目标列表中删除。

示例

以下示例演示了如何使用clearSubgoals()方法:

think.addSubgoal("subgoal1");
think.addSubgoal("subgoal2");
think.addSubgoal("subgoal3");
console.log(think.getSubgoals()); // ["subgoal1", "subgoal2", "subgoal3"]
think.clearSubgoals();
console.log(think.getSubgoals()); // []

在上述示例中,我们首先添加了三个子目标,然后使用console.log()函数输出了当前的子目标列表。接着,我们调用clearSubgoals()方法清除了所有子目标,并再次使用console.log()函数验证了子目标列表是否已清空。

参数

此方法不接受任何参数。

返回值

此方法无返回值。

异常

此方法不会引发任何异常。