/// <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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        void Start()
        {
            // Navigation manager
            NavigationManager.I.CurrentScene = AppScene.PlaySessionResult;

            // Calculate items to unlock count
            int itemsToUnlock = NavigationManager.I.CalculateUnlockItemCount();

            List <RewardPack> oldRewards = AppManager.I.Player.RewardsUnlocked.FindAll(ru => ru.PlaySessionId == AppManager.I.Player.CurrentJourneyPosition.ToString());
            int itemAlreadyUnlocked      = oldRewards.Count;

            for (int i = 0; i < itemsToUnlock - oldRewards.Count; i++)
            {
                // if necessary add one new random reward unlocked
                RewardPack newRewardToUnlock = RewardSystemManager.GetNextRewardPack()[0];
                oldRewards.Add(newRewardToUnlock);
                AppManager.I.Player.AddRewardUnlocked(newRewardToUnlock);
            }

            // Show UI result and unlock transform parent where show unlocked items
            GameObject[] objs = new GameObject[] { };
            objs = GameResultUI.ShowEndsessionResult(NavigationManager.I.UseEndSessionResults(), itemAlreadyUnlocked);

            for (int i = 0; i < objs.Length - oldRewards.Count; i++)
            {
                // if necessary add one new random reward not to be unlocked!
                oldRewards.Add(RewardSystemManager.GetNextRewardPack()[0]);
            }

            LogManager.I.LogPlaySessionScore(TeacherAI.I.journeyHelper.GetCurrentPlaySessionData().Id, objs.Length);
            // save max progression (internal check if necessary)
            NavigationManager.I.MaxJourneyPosistionProgress();

            // for any rewards mount them model on parent transform object (objs)
            for (int i = 0; i < oldRewards.Count && i < objs.Length; i++)
            {
                ModelsManager.MountModel(
                    oldRewards[i].ItemID,
                    objs[i].transform,
                    oldRewards[i].GetMaterialPair()
                    );
            }
        }