void SpawnRewardAndPoof()
        {
            // Reward
            rewardPack              = rewardsSceneController.GetRewardPackToInstantiate();
            rotationAngleView       = AppManager.I.RewardSystemManager.GetAnturaRotationAngleViewForRewardCategory(rewardPack.Category);
            newRewardInstantiatedGO = rewardsSceneController.InstantiateReward(rewardPack);
            newRewardInstantiatedGO.transform.localScale = Vector3.one * 0.001f;

            Pedestal.gameObject.SetActive(true);
            Pedestal.transform.localScale = Vector3.one;

            showTween2 = DOTween.Sequence().Pause()
                         .Join(Pedestal.DOScale(0.00001f, 1f).From().SetDelay(0.5f).SetEase(Ease.OutBack))
                         .AppendInterval(0.1f)
                         .Append(Pedestal.DORotate(new Vector3(0, rotationAngleView, 0), 0.3f, RotateMode.LocalAxisAdd).SetEase(Ease.InExpo))
                         .OnComplete(() => { IsComplete = true; })
                         .AppendCallback(() =>
            {
                if (PoofParticle == null || newRewardInstantiatedGO == null)
                {
                    return;
                }
                PoofParticle.transform.position = newRewardInstantiatedGO.transform.position;
                PoofParticle.Play();
                AudioManager.I.PlaySound(Sfx.Poof);
            })
                         .Append(newRewardInstantiatedGO.transform.DOScale(1f, 0.8f).SetEase(Ease.OutElastic))
                         .AppendInterval(0.3f)
                         .AppendCallback(() => { pedestalTween.Play(); });
            showTween2.Play();
        }
Esempio n. 2
0
 private void RewardSystemManager_OnRewardChanged(RewardPack rewardPack)
 {
     this.rewardPack = rewardPack;
     if (rewardPack.BaseType == RewardBaseType.Prop)
     {
         rotationAngleView = AppManager.I.RewardSystemManager.GetAnturaRotationAngleViewForRewardCategory(rewardPack.Category);
     }
 }
Esempio n. 3
0
 private void UnlockPack(RewardPack pack)
 {
     pack.SetUnlocked();
     pack.SetNew(true);
     if (VERBOSE)
     {
         Debug.Log("Unlocked pack " + pack);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Gets all the color items for a given base
        /// </summary>
        public List <RewardColorItem> GetRewardColorItemsForBase(RewardBase _Base)
        {
            List <RewardColorItem> returnList = new List <RewardColorItem>();

            // Load all colors for the given reward base
            var packsOfBase = GetRewardPacks().Where(x => x.RewardBase == _Base);

            foreach (var pack in packsOfBase)
            {
                bool isToBeShown = pack.IsUnlocked;
                if (isToBeShown)
                {
                    RewardColorItem rci = new RewardColorItem
                    {
                        data  = pack.RewardColor,
                        IsNew = pack.IsNew
                    };

                    returnList.Add(rci);
                    //Debug.Log("Found color: " + pack.RewardColor.Color1RGB + " and " + pack.RewardColor.Color2RGB);
                }
                else
                {
                    returnList.Add(null);
                }
            }

            // Selection state
            RewardPack alreadyEquippedPack = AppManager.I.Player.CurrentAnturaCustomizations.GetEquippedPack(_Base.ID);

            if (alreadyEquippedPack != null)
            {
                // If we already equipped a pack of that base, we use the previous color
                returnList.Find(item => item != null && item.data == alreadyEquippedPack.RewardColor).IsSelected = true;
            }
            else
            {
                // Else, we select the first available color
                foreach (var firstItem in returnList)
                {
                    if (firstItem != null)
                    {
                        firstItem.IsSelected = true;
                        return(returnList);
                    }
                }
            }

            return(returnList);
        }
Esempio n. 5
0
        private void RegisterLockedPack(RewardPack pack, JourneyPosition jp)
        {
            if (pack.HasUnlockData())
            {
                throw new Exception("Pack " + pack + " is already registered! Cannot register again");
            }

            // Add the unlock data and register it
            var unlockData = new RewardPackUnlockData(LogManager.I.AppSession, pack.UniqueId, jp)
            {
                IsLocked = true,
                IsNew    = true
            };

            AppManager.I.Player.RegisterUnlockData(unlockData);
            pack.SetUnlockData(unlockData);

            if (VERBOSE)
            {
                Debug.Log("Registered locked pack " + pack);
            }
        }
Esempio n. 6
0
        private List <RewardPack> BuildPacks(RewardPartsConfig partsConfig, RewardBaseType baseType)
        {
            var bases  = partsConfig.GetBasesForType(baseType);
            var colors = partsConfig.GetColorsForType(baseType);

            if (VERBOSE)
            {
                Debug.Log("Building packs for " + baseType
                          + "\n Bases: " + bases.Count() + " Colors: " + colors.Count());
            }

            List <RewardPack> rewardPacks = new List <RewardPack>();

            foreach (var b in bases)
            {
                foreach (var c in colors)
                {
                    RewardPack pack = new RewardPack(baseType, b, c);
                    rewardPacks.Add(pack);
                }
            }
            return(rewardPacks);
        }
Esempio n. 7
0
        IEnumerator Start()
        {
            LockClosed.gameObject.SetActive(false);
            LockOpen.gameObject.SetActive(false);
            Pedestal.gameObject.SetActive(true);

            // Reward
            rewardsSceneController = GetComponent <RewardsScene>();
            rewardsSceneController.ClearLoadedRewardsOnAntura();
            rewardPack              = rewardsSceneController.GetRewardPackToInstantiate();
            rotationAngleView       = AppManager.I.RewardSystemManager.GetAnturaRotationAngleViewForRewardCategory(rewardPack.Category);
            newRewardInstantiatedGO = rewardsSceneController.InstantiateReward(rewardPack);

            if (newRewardInstantiatedGO)
            {
                newRewardInstantiatedGO.transform.DOScale(0.00001f, 0f).SetEase(Ease.OutBack);
                showTween = DOTween.Sequence().Pause()
                            .Append(LockClosed.DOScale(0.0001f, 0.45f).From().SetEase(Ease.OutBack))
                            .AppendInterval(0.3f)
                            .AppendCallback(() => { alarmClockSound = AudioManager.I.PlaySound(Sfx.AlarmClock); })
                            .Append(LockClosed.DOShakePosition(0.8f, 40f, 16, 90, false, false))
                            .Join(LockClosed.DOShakeRotation(0.8f, new Vector3(0, 0, 70f), 16, 90, false))
                            .Join(LockClosed.DOPunchScale(Vector3.one * 0.8f, 0.4f, 20))
                            .AppendCallback(() => {
                    LockClosed.gameObject.SetActive(false);
                    LockOpen.gameObject.SetActive(true);
                    if (alarmClockSound != null)
                    {
                        alarmClockSound.Stop();
                    }
                    AudioManager.I.PlaySound(Sfx.UIPopup);
                })
                            .Join(LockClosed.DOScale(0.00001f, 0.4f))
                            .Join(LockOpen.DOScale(0.00001f, 0.4f).From().SetEase(Ease.OutBack))
                            .Join(Godray1.DOScale(0.00001f, 0.3f).From())
                            .AppendInterval(0.7f)
                            .Append(LockOpen.DOScale(0.00001f, 0.6f).SetEase(Ease.InBack))
                            .AppendCallback(() => { AudioManager.I.PlaySound(Sfx.Win); })
                            .Join(LockOpen.DORotate(new Vector3(0, 0, 360), 0.6f, RotateMode.FastBeyond360).SetRelative().SetEase(Ease.InCubic))
                            .Join(Godray1.DOScale(0.00001f, 0.6f).SetEase(Ease.InCubic))
                            .Join(Pedestal.DOScale(0.00001f, 1f).From().SetDelay(0.5f).SetEase(Ease.OutBack))
                            .Append(Pedestal.DORotate(new Vector3(0, rotationAngleView, 0), 0.3f, RotateMode.LocalAxisAdd).SetEase(Ease.InExpo))
                            .OnComplete(() => { IsComplete = true; })
                            .AppendInterval(0.1f)
                            .AppendCallback(() => playParticle())
                            .Append(newRewardInstantiatedGO.transform.DOScale(1f, 0.8f).SetEase(Ease.OutElastic))
                            .AppendInterval(0.3f)
                            .AppendCallback(() => { pedestalTween.Play(); });
            }
            else
            {
                showTween = DOTween.Sequence().Pause()
                            .Append(LockClosed.DOScale(0.0001f, 0.45f).From().SetEase(Ease.OutBack))
                            .AppendInterval(0.3f)
                            .AppendCallback(() => { alarmClockSound = AudioManager.I.PlaySound(Sfx.AlarmClock); })
                            .Append(LockClosed.DOShakePosition(0.8f, 40f, 16, 90, false, false))
                            .Join(LockClosed.DOShakeRotation(0.8f, new Vector3(0, 0, 70f), 16, 90, false))
                            .Join(LockClosed.DOPunchScale(Vector3.one * 0.8f, 0.4f, 20))
                            .AppendCallback(() => {
                    LockClosed.gameObject.SetActive(false);
                    LockOpen.gameObject.SetActive(true);
                    if (alarmClockSound != null)
                    {
                        alarmClockSound.Stop();
                    }
                    AudioManager.I.PlaySound(Sfx.UIPopup);
                })
                            .Join(LockClosed.DOScale(0.00001f, 0.4f))
                            .Join(LockOpen.DOScale(0.00001f, 0.4f).From().SetEase(Ease.OutBack))
                            .Join(Godray1.DOScale(0.00001f, 0.3f).From())
                            .AppendInterval(0.7f)
                            .Append(LockOpen.DOScale(0.00001f, 0.6f).SetEase(Ease.InBack))
                            .AppendCallback(() => { AudioManager.I.PlaySound(Sfx.Win); })
                            .Join(LockOpen.DORotate(new Vector3(0, 0, 360), 0.6f, RotateMode.FastBeyond360).SetRelative().SetEase(Ease.InCubic))
                            .Join(Godray1.DOScale(0.00001f, 0.6f).SetEase(Ease.InCubic))
                            .Join(Pedestal.DOScale(0.00001f, 1f).From().SetDelay(0.5f).SetEase(Ease.OutBack))
                            .Append(Pedestal.DORotate(new Vector3(0, rotationAngleView, 0), 0.3f, RotateMode.LocalAxisAdd).SetEase(Ease.InExpo))
                            .OnComplete(() => { IsComplete = true; })
                            .AppendInterval(0.1f)
                            .AppendCallback(() => playParticle())
                            .AppendInterval(0.3f)
                            .AppendCallback(() => { pedestalTween.Play(); });
            }
            //showTween.Insert(showTween.Duration(false) - 1, AnturaButton.DOAnchorPosY(-200, 0.4f).From(true).SetEase(Ease.OutBack));

            godraysTween = DOTween.Sequence().SetLoops(-1, LoopType.Restart)
                           .Append(Godray0.DORotate(new Vector3(0, 0, 360), Godrays360Duration, RotateMode.FastBeyond360).SetRelative()
                                   .SetEase(Ease.Linear))
                           .Join(Godray1.DORotate(new Vector3(0, 0, -360), Godrays360Duration, RotateMode.FastBeyond360).SetRelative()
                                 .SetEase(Ease.Linear));

            pedestalTween = Pedestal.DORotate(new Vector3(0, 360, 0), Pedestal360Duration, RotateMode.LocalAxisAdd)
                            .SetEase(Ease.Linear).SetLoops(-1).Pause();

            // Wait a couple frames to allow Unity to load correctly
            yield return(new WaitForSeconds(0.3f));

            LockClosed.gameObject.SetActive(true);
            showTween.Play();
        }
Esempio n. 8
0
 /// <summary>
 /// Instantiates the reward, mount on antura and return gameobject.
 /// </summary>
 /// <param name="_rewardToInstantiate">The reward to instantiate.</param>
 /// <returns></returns>
 public GameObject InstantiateReward(RewardPack _rewardToInstantiate)
 {
     return(AnturaModelManager.I.LoadRewardPackOnAntura(_rewardToInstantiate));
 }