Esempio n. 1
0
    void Start()
    {
        Grid = GetComponent <s_grid>();
        Grid.Initialize();
        Player = GameObject.Find("player").GetComponent <o_player>();

        GameObject       lev = GameObject.Find("Game");
        s_levelstructure l   = lev.GetComponent <s_levelstructure>();

        GameObject ingalev = GameObject.Find("InGame");

        ing = ingalev.GetComponent <s_levelstructure>();

        List <data_level> lstruct = new List <data_level>();

        lstruct = l.levels;

        if (GameObject.Find("Position") != null)
        {
            txt = GameObject.Find("Position").GetComponent <UnityEngine.UI.Text>();
        }

        //Copy all the data from the Editor's to the inGame's
        foreach (data_level da in lstruct)
        {
            ing.levels.Add(da);
        }

        levels = ing.levels;
        //De-references the original levels object so it dosen't get changed.
        l = null;
        LoadLevel();
    }
    public void LevelStructureLoad()
    {
        GameObject       lev = (GameObject)Resources.Load("Game");
        s_levelstructure l   = lev.GetComponent <s_levelstructure>();

        List <data_level> lstruct = l.levels;

        levels = lstruct;
    }
    public void SaveEntireLevelStructure()
    {
        GameObject       lev = (GameObject)Resources.Load("Game");
        s_levelstructure l   = lev.GetComponent <s_levelstructure>();

        List <data_level> lstruct = new List <data_level>();

        lstruct = levels;

        foreach (data_level le in lstruct)
        {
            l.levels.Add(le);
        }
    }