Beispiel #1
0
    // Use this for initialization
    private void Awake()
    {
        if (Inst == null)
        {
            Inst = this;
        }

        FloorDataManager.Init();

        if (!File.Exists(Application.persistentDataPath + "/gamesave.save"))
        {
            MdlPlayer.Init();
        }
        else
        {
            var savedData = LoadData();
            if (savedData != null)
            {
                MdlPlayer.Init(savedData);
                var cash         = savedData.Cash;
                var currenttower = savedData.CurrentTowerId;
                var floors       = savedData.FloorsLvlsInTowers;
                var tower0       = floors[1];
                Debug.Log(string.Format("cash: {0}, currenttower: {1}, towers count: {2}, floors at 1 tower: {3}, 1st floor exp: {4}, id: {5}, HelperLeve: {6}", cash, currenttower, floors.Count, floors[1].Count, tower0[0].Exp, tower0[0].Id, tower0[0].HelperLevel));
            }

            else
            {
                Debug.Log("SavedGame was damaged, creating new game");
                MdlPlayer.Init();
            }
        }

        Application.runInBackground = true;
    }