public void LoadGame(string path)
    {
        var data = LoadSaveSystem.Load(path);

        if (data != null)
        {
            Options = data.Options;
            InitField(Options.FieldSize);

            CellsMarked = 0;
            CellsOpened = 0;
            for (int i = 0; i < Options.FieldSize.x; ++i)
            {
                for (int j = 0; j < Options.FieldSize.y; ++j)
                {
                    var cell = cells[i, j];

                    cell.Init(data.Cells[i * Options.FieldSize.x + j]);

                    if (cell.Data.Marked)
                    {
                        ++CellsMarked;
                    }
                    if (cell.Data.Opened)
                    {
                        ++CellsOpened;
                    }
                }
            }

            UpdateBombCounters();

            IsGameRunning = true;
        }
    }
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     dataManager = new LoadSaveSystem();
 }
Exemple #3
0
 private void Awake()
 {
     rbController   = this.GetComponent <Rigidbody2D>();
     loadSaveSystem = MenuController.Instance.GetPlayerStats();
     if (loadSaveSystem == null)
     {
         Debug.Log("NULOOOO");
     }
     explosion.SetActive(false);
     thrusterAudio  = AudioManager.Instance._sfx[0];
     explosionAudio = AudioManager.Instance._sfx[1];
 }
    public void SaveGame()
    {
        var fieldState = new CellData[Options.FieldSize.x, Options.FieldSize.y];

        for (int i = 0; i < Options.FieldSize.x; ++i)
        {
            for (int j = 0; j < Options.FieldSize.y; ++j)
            {
                fieldState[i, j] = cells[i, j].Data;
            }
        }
        LoadSaveSystem.Save(new GameSessionData(Options, fieldState));
    }
    private void Awake()
    {
        if (menuControllerInstance == null)
        {
            menuControllerInstance = this;
            //DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        playerStats    = new LoadSaveSystem();
        avatarSelected = "UFO_player";
    }
Exemple #6
0
 private void Awake()
 {
     Debug.Log("LoadSaveSystem");
     instance = this;
 }