Esempio n. 1
0
    void Start()
    {
        int levelIndex = (bypassPrefsLevel) ? 1 : PlayerPrefs.GetInt("Level");

        if (initRowCount != 0 && initColumnCount != 0)
        {
            GridElementLevel level = new GridElementLevel();
            level.columns  = initColumnCount;
            level.rows     = initRowCount;
            level.elements = new List <Element>();
            for (int i = 0; i < level.rows * level.columns; i++)
            {
                Element newElement = Instantiate(UnitCube);
                level.elements.Add(newElement);
            }
            SetGrid(level);
        }
        else if (SerializeJson.LevelExists(levelIndex))
        {
            LoadLevel(levelIndex);
            if (editorContainer != null)
            {
                editorContainer.SetActive(false);
            }
        }
    }