Пример #1
0
        /// <summary>
        /// Unlock selected achievement
        /// </summary>
        /// <param name="achievement"></param>
        private void UnlockAchievement(Achievement achievement, Text outputHeader, Image outputIcon)
        {
            if (!achievement.GetState())
            {
                if (achievement is ProgressAchievement)
                {
                    ProgressAchievement progressAchievement = (ProgressAchievement)achievement;
                    progressAchievement.AddProgress(100);
                }

                achievement.SetState(true);
                Notify(prefabAchievement, achievement.GetID(), false);
                Output(outputHeader, outputIcon, achievement);
            }
        }
Пример #2
0
        /// <summary>
        /// Create selected achievement
        /// </summary>
        /// <param name="achievement"></param>
        /// <param name="headerName"></param>
        /// <param name="iconName"></param>
        public void GetAchievementInPrefab(Achievement achievement)
        {
            if (!achievement.GetState())
            {
                GameObject instance = Instantiate(prefabAchievement, achievementsGrid);
                Text       header   = instance.transform.Find(prefabNameHeader).GetComponent <Text>();
                Image      icon     = instance.transform.Find(prefabNameIcon).GetComponent <Image>();

                instance.GetComponent <AchievementElement>().SetAnimationState(true);
                instance.GetComponent <AchievementElement>().SetAchievementID(achievement.GetID());

                UnlockAchievement(achievement, header, icon);

                Destroy(instance, timeOfDestroying);
            }
        }