Exemplo n.º 1
0
        /// <summary>
        /// Creates the level.
        /// </summary>
        /// <param name="jsonText">The JSON text to create the level with.</param>
        private void CreateLevel(string jsonText)
        {
            Debug.Log(jsonText);

            JSONObject input = new JSONObject(jsonText);

            JSONObject    lemmingsJSON  = input.GetField("lemmings");
            LemmingsInput lemmingsInput = new LemmingsInput(lemmingsJSON);

            JSONObject goalJSON  = input.GetField("goal");
            GoalInput  goalInput = new GoalInput(goalJSON);

            CreateLemmings(lemmingsInput);
            CreateGoal(goalInput);

            CreateBoundingBoxes(input);

            JSONObject routeJSON = input.GetField("route");

            if (routeJSON != null)
            {
                RouteInput routeInput = new RouteInput(routeJSON);
                RouteRenderer.instance.DrawRoute(lemmingsInput.position, routeInput.route, goalInput.position);
            }

            LevelLogger.instance.json = jsonText;
            gameManager.isLoading     = false;
            GameManager.numDeaths     = 0;
            gameManager.CountDownStart();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates the goal in the level.
 /// </summary>
 /// <param name="lemmingsInput">JSON data for the goal.</param>
 private void CreateGoal(GoalInput goalInput)
 {
     ObjectUtil.Instantiate(goalPrefab, goalInput.position);
 }