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

resolveReferences

功能

该函数是MovingEntity类的方法,用于在实体中解析任何可能存在的引用,并将其转化为对应实体的引用对象。解析后的引用对象将被存储在该实体内部,并可被随后的函数调用所引用。

参数

该函数无需传入参数。

返回值

该函数没有返回值。

示例

const entity1 = new MovingEntity(1);
const entity2 = new MovingEntity(2);
const entity3 = new MovingEntity(3);

entity1.steeringBehavior.target = entity2;
entity2.steeringBehavior.target = entity3;

entity1.resolveReferences();
entity2.resolveReferences();
entity3.resolveReferences();

在上述示例中,实体entity1和entity2都包含对其他实体的引用。在调用resolveReferences方法后,这些引用将被成功解析为具体的引用对象,存储在对应的实体内部。

注意事项

  • 该方法只有在所有实体的引用已经设置完毕后才能被调用。
  • 该方法需要在任何其他可能使用到实体引用的方法之前调用。
  • 调用该方法之前,必须确保所有的实体在管理器中都被正确初始化并且存在于管理器的实体列表中。