Пример #1
0
    public void SetSceneToConfigPath()
    {
        DeleteAllGravityBody();

        config = GetJsonNode(filePath);
        if (config == null)
        {
            return;
        }

        foreach (JSONNode node in config["bodies"])
        {
            CreateGravityBody(node);
        }

        loadPathText.text = this.filePath;

        GravityBody.Initialize();

        Vector3 cameraLookat   = JSONNodeToVector3(config["cameraLookat"]);
        Vector3 cameraPosition = JSONNodeToVector3(config["cameraPosition"]);

        CameraLookat = cameraLookat;

        Camera.main.transform.position = cameraPosition;
        Camera.main.transform.LookAt(cameraLookat);

        Debug.Log("Reset to load state, " + this.filePath + config.ToString());

        TextManager.GetInstance().UpdateCameraText();
    }