Пример #1
0
        /// <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);
        }
Пример #2
0
        /// <summary>
        /// Initializes a wall.
        /// </summary>
        /// <param name="json">JSON data for the wall.</param>
        internal WallInput(JSONObject json)
        {
            endpoints = new Vector3[2];
            List <JSONObject> endpointList = json.list;

            for (int i = 0; i < endpoints.Length; i++)
            {
                endpoints[i] = JSONUtil.MakeVectorFromJSON(endpointList[i]);
            }
        }
Пример #3
0
 /// <summary>
 /// Initializes a goal.
 /// </summary>
 /// <param name="json">JSON data for the goal./param>
 internal GoalInput(JSONObject json)
 {
     if (json == null)
     {
         position = Vector3.zero;
     }
     else
     {
         position = JSONUtil.MakeVectorFromJSON(json);
     }
 }
Пример #4
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;
     }
 }