Ejemplo n.º 1
0
        public IEnumerator AsyncLoadGame()
        {
            string path = file.FullName;

            canvas.transform.SleepChildren();
            loadingScreen.StartLoad();
            AsyncOperation asyncLoad = SceneManager.LoadSceneAsync("MainGame");
            string         json      = File.ReadAllText(path);

            while (!asyncLoad.isDone)
            {
                loadingScreen.progresBar.text = $"Loading progess: {asyncLoad.progress * 100}%";
                yield return(null);
            }
            // wait so everything is loaded
            yield return(new WaitForEndOfFrame());

            SaveMananger saveMananger = SaveMananger.Instance;
            Save         save         = saveMananger.NewSave;

            save.LoadData(json);
            Debug.Log(json);
            CanvasMain.GetCanvasMain.Resume();
            Destroy(gameObject);
        }
Ejemplo n.º 2
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
        player = player != null ? player : PlayerMain.GetPlayer;

        SaveFolder = Directory.Exists(SaveSettings.SaveFolder)
            ? new DirectoryInfo(SaveSettings.SaveFolder)
            : Directory.CreateDirectory(SaveSettings.SaveFolder);
        Settings.Load();
    }
Ejemplo n.º 3
0
 public void Awake()
 {
     instance = this;
     Load();
 }
Ejemplo n.º 4
0
 public void Awake()
 {
     //DontDestroyOnLoad(gameObject);
     instance = this;
     Load();
 }