示例#1
0
 /// <summary>
 /// Triggered when the actual loading is done, replaces the progress bar with the complete animation
 /// </summary>
 protected virtual void LoadingComplete()
 {
     LoadingCompleteAnimation.gameObject.SetActive(true);
     StartCoroutine(MMFade.FadeCanvasGroup(LoadingProgressBar, 0.1f, 0f));
     StartCoroutine(MMFade.FadeCanvasGroup(LoadingAnimation, 0.1f, 0f));
     StartCoroutine(MMFade.FadeCanvasGroup(LoadingCompleteAnimation, 0.1f, 1f));
 }
示例#2
0
 /// <summary>
 /// Triggered when the actual loading is done, replaces the progress bar with the complete animation
 /// </summary>
 protected virtual void LoadingComplete()
 {
     LoadingSceneEvent.Trigger(_sceneToLoad, LoadingStatus.LoadComplete);
     LoadingCompleteAnimation.gameObject.SetActive(true);
     StartCoroutine(MMFade.FadeCanvasGroup(LoadingProgressBar, 0.1f, 0f));
     StartCoroutine(MMFade.FadeCanvasGroup(LoadingAnimation, 0.1f, 0f));
     StartCoroutine(MMFade.FadeCanvasGroup(LoadingCompleteAnimation, 0.1f, 1f));
 }
        /// <summary>
        /// Instantiates an achievement display prefab and shows it for the specified duration
        /// </summary>
        /// <returns>The achievement.</returns>
        /// <param name="achievement">Achievement.</param>
        public virtual IEnumerator DisplayAchievement(MMAchievement achievement)
        {
            if ((this.transform == null) || (AchievementDisplayPrefab == null))
            {
                yield break;
            }

            // we instantiate our achievement display prefab, and add it to the group that will automatically handle its position
            GameObject instance = (GameObject)Instantiate(AchievementDisplayPrefab.gameObject);

            instance.transform.SetParent(this.transform, false);

            // we get the achievement displayer
            MMAchievementDisplayItem achievementDisplay = instance.GetComponent <MMAchievementDisplayItem> ();

            if (achievementDisplay == null)
            {
                yield break;
            }

            // we fill our achievement
            achievementDisplay.Title.text       = achievement.Title;
            achievementDisplay.Description.text = achievement.Description;
            achievementDisplay.Icon.sprite      = achievement.UnlockedImage;
            if (achievement.AchievementType == AchievementTypes.Progress)
            {
                achievementDisplay.ProgressBarDisplay.gameObject.SetActive(true);
            }
            else
            {
                achievementDisplay.ProgressBarDisplay.gameObject.SetActive(false);
            }

            // we play a sound if set
            if (achievement.UnlockedSound != null)
            {
                MMSfxEvent.Trigger(achievement.UnlockedSound);
            }

            // we fade it in and out
            CanvasGroup achievementCanvasGroup = instance.GetComponent <CanvasGroup> ();

            if (achievementCanvasGroup != null)
            {
                achievementCanvasGroup.alpha = 0;
                StartCoroutine(MMFade.FadeCanvasGroup(achievementCanvasGroup, AchievementFadeDuration, 1));
                yield return(_achievementFadeOutWFS);

                StartCoroutine(MMFade.FadeCanvasGroup(achievementCanvasGroup, AchievementFadeDuration, 0));
            }
        }