/// <summary> /// Unlocks all rewards. /// </summary> public static void UnlockAllRewards() { Debug.Log("Unlocking a lot of rewards"); // First reward manual add AppManager.I.Player.AddRewardUnlocked(RewardSystemManager.GetFirstAnturaReward(RewardTypes.reward)); var actualCurrentJourneyPosition = AppManager.I.Player.CurrentJourneyPosition; var allPlaySessionInfos = AppManager.I.Teacher.scoreHelper.GetAllPlaySessionInfo(); for (int i = 0; i < allPlaySessionInfos.Count; i++) { AppManager.I.Player.SetCurrentJourneyPosition(AppManager.I.Teacher.journeyHelper.PlaySessionIdToJourneyPosition(allPlaySessionInfos[i].data.Id)); foreach (RewardPack pack in RewardSystemManager.GetNextRewardPack()) { AppManager.I.Player.AddRewardUnlocked(pack); } } AppManager.I.Player.SetCurrentJourneyPosition(actualCurrentJourneyPosition); }
IEnumerator StartReward() { // Wait for animation to complete //RewardsAnimator animator = this.GetComponent<RewardsAnimator>(); //while (!animator.IsComplete) // yield return null; yield return(new WaitForSeconds(3.5f)); /* FIRST CONTACT FEATURE */ if (AppManager.I.Player.IsFirstContact()) { KeeperManager.I.PlayDialog(Db.LocalizationDataId.Reward_Intro); // Clean and Charge antura reward. AnturaModelManager.Instance.ClearLoadedRewards(); RewardPack firstUnlockedReward = RewardSystemManager.GetFirstAnturaReward(RewardTypes.reward); AppManager.I.Player.AddRewardUnlocked(firstUnlockedReward); AnturaModelManager.Instance.LoadRewardPackOnAntura(firstUnlockedReward); } else { int rnd = Random.Range(1, 3); switch (rnd) { case 1: KeeperManager.I.PlayDialog(Db.LocalizationDataId.Reward_Big_1); break; case 3: KeeperManager.I.PlayDialog(Db.LocalizationDataId.Reward_Big_2); break; default: KeeperManager.I.PlayDialog(Db.LocalizationDataId.Reward_Big_3); break; } AnturaModelManager.Instance.ClearLoadedRewards(); RewardPack newUnlockedReward = RewardSystemManager.GetNextRewardPack()[0]; AppManager.I.Player.AddRewardUnlocked(newUnlockedReward); AnturaModelManager.Instance.LoadRewardPackOnAntura(newUnlockedReward); } /* --------------------- */ ContinueScreen.Show(Continue, ContinueScreenMode.Button); yield return(null); }
/// <summary> /// Return PlayerProfile with avatar id in param. /// If not exist create new with default settings. /// </summary> /// <param name="_avatarId"></param> /// <returns></returns> public PlayerProfile CreateOrLoadPlayerProfile(int _avatarId) { bool isNew = false; PlayerProfile returnProfile = LoadPlayerProfileByAvatarId(_avatarId); if (returnProfile == null) { returnProfile = new PlayerProfile(); isNew = true; // create new returnProfile.Id = AvailablePlayerProfiles.Count + 1; returnProfile.AvatarId = _avatarId; returnProfile.Key = returnProfile.Id.ToString(); returnProfile = AppManager.I.Modules.PlayerProfile.CreateNewPlayer(returnProfile) as PlayerProfile; } // Create new antura skin RewardPack tileTexture = RewardSystemManager.GetFirstAnturaReward(RewardTypes.texture); returnProfile.AddRewardUnlocked(tileTexture); returnProfile.CurrentAnturaCustomizations.TileTexture = tileTexture; RewardPack decalTexture = RewardSystemManager.GetFirstAnturaReward(RewardTypes.decal); returnProfile.AddRewardUnlocked(decalTexture); returnProfile.CurrentAnturaCustomizations.DecalTexture = decalTexture; // ----- AppManager.I.PlayerProfileManager.CurrentPlayer = returnProfile as PlayerProfile; AppManager.I.PlayerProfileManager.availablePlayerProfiles.Add(AppManager.I.PlayerProfileManager.CurrentPlayer); AppManager.I.PlayerProfileManager.CurrentPlayer.Save(); SaveGameSettings(); if (isNew && OnNewProfileCreated != null) { OnNewProfileCreated(); } return(AppManager.I.PlayerProfileManager.CurrentPlayer); }