/// <summary> /// Initializes a platform. /// </summary> /// <param name="json">JSON data for the platform.</param> internal PlatformInput(JSONObject json) { JSONObject pointObject = json.GetField("points"); if (pointObject == null) { pointObject = json; } List <JSONObject> jsonList = pointObject.list; vertices = new List <Vector3>(jsonList.Count); Vector3 startVertex = Vector3.zero; for (int i = 0; i < jsonList.Count; i++) { JSONObject vertexJSON = jsonList[i]; Vector3 vertex = JSONUtil.MakeVectorFromJSON(vertexJSON); if (i == 0) { startVertex = vertex; } if (i < jsonList.Count - 1 || startVertex != vertex) { vertices.Add(vertex); } } height = JSONUtil.GetIfExists(json, "height", 0); }
/// <summary> /// Initializes a lemming spawn point. /// </summary> /// <param name="json">JSON data for the lemming spawn point.</param> internal LemmingsInput(JSONObject json) { if (json == null) { position = Vector3.zero; rotation = 0; amount = 0; } else { position = JSONUtil.MakeVectorFromJSON(json.GetField("position")); rotation = JSONUtil.GetIfExists(json, "rotation", 0); amount = (int)json.GetField("amount").i; } }