void Awake() { creator = FindObjectOfType <TPAchievementCreator>(); creator.SetOnNotifySet(ChangeNotificationBehavior); creator.SetOnNotifyActive(ChangeNotifyActiveBehavior); a_Space = creator.GetAchievement("Space"); a_Space10 = creator.GetAchievement("Space10"); }
public void Complete() { TPAchievementData data = new TPAchievementData() { ReachPoints = 10 }; TPAchievement <TPAchievementData> achievement = new TPAchievement <TPAchievementData>(data); achievement.Complete(); data.IsCompleted = true; Assert.IsTrue(achievement.Data.IsCompleted); }
public void AddPoints() { TPAchievementData data = new TPAchievementData() { ReachPoints = 10 }; TPAchievement <TPAchievementData> achievement = new TPAchievement <TPAchievementData>(data); achievement.AddPoints(); Assert.AreEqual(1, achievement.Data.Points); achievement.AddPoints(5); Assert.AreEqual(6, achievement.Data.Points); achievement.AddPoints(555); Assert.AreEqual(10, achievement.Data.Points); }
void ChangeNotificationBehavior(TPNotification notification, TPAchievement achievement) { if (achievement.IsCompleted) { notification.descriptionText.enabled = true; notification.maxPointsText.gameObject.SetActive(false); notification.pointsText.gameObject.SetActive(false); } else { notification.descriptionText.enabled = false; notification.maxPointsText.gameObject.SetActive(true); notification.pointsText.gameObject.SetActive(true); } notification.SetNotification(achievement); }