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

fromJSON

简介

fromJSONSingletonFuzzySet 类的一个方法,该方法用于将符合特定格式的 JSON 数据转化为 SingletonFuzzySet 对象。

语法

SingletonFuzzySet.fromJSON(jsonData);

参数

  • jsonData: 必选参数,表示待转换的 JSON 格式的数据。该参数应符合以下格式:

    {
        "name": string,     // 必须,表示对象的名称
        "value": number     // 必须,表示对象的取值
    }
    

返回值

  • 如果参数 jsonData 符合特定格式,则会返回转换后的 SingletonFuzzySet 对象;如果参数不符合格式要求,则会返回 null

示例

const jsonData = {
    "name": "Temperature",
    "value": 26.5
};

const set = SingletonFuzzySet.fromJSON(jsonData);
console.log(set.name);    // "Temperature"
console.log(set.value);   // 26.5

异常

  • 如果参数 jsonData 不符合特定格式要求,则会抛出异常。