void Start() { SceneManager.sceneLoaded += SceneChanged; _firstScene = true; if (LoadSavedGame) { _data = SaveLoadHelper.LoadGame(); } if (_data != null) { DeactivateUsernameUi(); _load = true; _saveLoaded = true; SceneName = _data.GetLoadedScene(); if (string.IsNullOrEmpty(SceneName)) { SceneName = SceneLoader.DefaultStartScene; } StartCoroutine(LoadNewScene()); } else { _data = new PlayerData(Element.Air); SceneName = _data.GetLoadedScene(); } }
public void OnFirstSceneLoaded() { UIManager.gameObject.SetActive(true); Data = SceneLoader.GetPlayerData(); if (SceneLoader.IsLoadSuccesfull()) { InitGameForLoadedData(); } else { if (Data == null) { Data = new PlayerData(Element.Air); } InitializeGameForFirstPlay(); } MageButtons.OnFirstSceneLoaded(); MageButtons.AddPlayerButton(); UIManager.SkillCancelButton.SetActive(false); AssignActions(); // Give Daily Bonus DailyBonusManager.InitiateRewardPage(); AchievementManager.SetAchievementKeeper(Data.GetAchievementData()); OnSceneChange(Data.GetLoadedScene()); if (PlayerPrefs.GetString("_gameCloseTime") != "") { //idle income generation CalculateIdleIncomeAndShowNotification(); } }