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

toJSON

描述

toJSON 是一个将 RightShoulderFuzzySet 转换为 JSON 字符串的函数。

语法

fuzzySet.toJSON()

返回值

返回包含 RightShoulderFuzzySet 对象属性的 JSON 字符串。

示例

const FuzzySet = require('yuka');
const set = new FuzzySet.RightShoulderFuzzySet(20, 40, 60);

const json = set.toJSON();
console.log(json);
// Output: '{"type":"RightShoulderFuzzySet","left":20,"right":40,"height":60}'

属性

  • type:模糊集类型,固定值为 "RightShoulderFuzzySet"
  • left:模糊集左端点。
  • right:模糊集右端点。
  • height:模糊集高度。

异常

如果 toJSON 函数调用失败,将抛出一个异常。

备注

JSON 字符串可以传输和存储数据。要将 JSON 字符串转换回 RightShoulderFuzzySet 对象,请使用 RightShoulderFuzzySet.fromJSON(json) 函数。

参考