Ejemplo n.º 1
0
    // *LevelStart Instantation*
    private void LevelStart_init(int l)
    {
        // Read the json file into a local string
        string json = maps[l];

        // Build json string into an object
        //levelActive = JsonUtility.FromJson<LevelStatic>(json);

        levelRandom = JsonUtility.FromJson <LevelRandom>(json);

        // Sets the main camera  to the same size at the levelActive height
        CameraMain.orthographicSize = (float)levelRandom.height * 5 / 6;

        // Shifts the grid postion when a map had odd width.
        UIGrid.localPosition = new Vector3(-ScreenMain.GetComponent <RectTransform>().rect.width / 2, -ScreenMain.GetComponent <RectTransform>().rect.height / 2, 0);
        if (levelRandom.width % 2 == 1)
        {
            UIGrid.localPosition = new Vector3(-ScreenMain.GetComponent <RectTransform>().rect.width / 2 - 0.5f, -ScreenMain.GetComponent <RectTransform>().rect.height / 2 - 0.5f, 0);
        }

        childLevelStart.LevelGenerate(levelRandom);


        //childLevelStart.LevelLoad(levelActive);
    }