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

initConsequence

介绍

initConsequence方法用于在FuzzyRule对象中初始化后件(consequence)的初始值。后件是一个集合,它表示了当规则条件(condition)满足时要执行的操作。该方法将后件变量初始化为一个指定的值。

语法

rule.initConsequence(consequenceVariable, initialValue);

参数

  • consequenceVariable: 后件变量(object) - 要初始化的后件变量对象。
  • initialValue: 初始值(number) - 后件变量的初始值。

示例

// 创建一个模糊规则对象
var rule1 = new FuzzyRule();

// 初始化后件变量的初始值
rule1.initConsequence(rule1.createConsequence("brightness"), 0.5);
rule1.initConsequence(rule1.createConsequence("saturation"), 0.8);

注意事项

  • 必须先创建后件变量对象,并将其传递给initConsequence方法。
  • 初始值必须是一个数字,代表后件变量的初始值。
  • 如果initConsequence方法没有被调用,则后件变量的初始值将为null