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

visible

描述

visible 是 MemoryRecord 中的一个属性,表示记录是否可见。当 visibletrue 时,记录被认为是可见的,反之则被认为是不可见的。

使用

读取属性值

可以通过访问属性来获取 visible 的值。例如:

const record = new MemoryRecord();

// 获取 visible 的值
const visible = record.visible;

设置属性值

可以通过设置属性来更改 visible 的值。例如:

const record = new MemoryRecord();

// 将 visible 设置为 true
record.visible = true;

监听属性变化

可以使用 on 方法来监听 visible 属性的变化。例如:

const record = new MemoryRecord();

record.on('change:visible', (newValue, oldValue) => {
  console.log(`visible 已经从 ${oldValue} 变成了 ${newValue}`);
});

record.visible = true;  // 触发 'change:visible' 事件

注意

  • visible 属性的默认值为 true
  • 尝试设置 visible 属性为非布尔值会导致抛出异常。
  • 修改 visible 属性会触发由 on 方法添加的回调函数。