コード例 #1
0
        public void TestRankCalculator()
        {
            const int experienceForOneLevel = 2758;

            var returnedRank = ExperienceCalculator.GetPlayerLevelFromExperienceTotal(0);

            Assert.AreEqual(returnedRank, PlayerLevel.TypoL1);

            returnedRank = ExperienceCalculator.GetPlayerLevelFromExperienceTotal(experienceForOneLevel - 1);
            Assert.AreEqual(returnedRank, PlayerLevel.TypoL1);

            returnedRank = ExperienceCalculator.GetPlayerLevelFromExperienceTotal(experienceForOneLevel);
            Assert.AreEqual(returnedRank, PlayerLevel.TypoL2);

            returnedRank = ExperienceCalculator.GetPlayerLevelFromExperienceTotal(experienceForOneLevel + 1);
            Assert.AreEqual(returnedRank, PlayerLevel.TypoL2);

            returnedRank = ExperienceCalculator.GetPlayerLevelFromExperienceTotal(3 * experienceForOneLevel - 1);
            Assert.AreEqual(returnedRank, PlayerLevel.TypoL2);

            returnedRank = ExperienceCalculator.GetPlayerLevelFromExperienceTotal(3 * experienceForOneLevel);
            Assert.AreEqual(returnedRank, PlayerLevel.TypoL3);

            returnedRank = ExperienceCalculator.GetPlayerLevelFromExperienceTotal(10000000);
            Assert.AreEqual(returnedRank, PlayerLevel.TheTruthL3);
        }
コード例 #2
0
        private static IJiraQuest PrepareJiraQuest()
        {
            IExperienceCalculator expCalculator = new ExperienceCalculator();
            IJiraQuest            quest         = new JiraQuest(expCalculator);

            quest.SprintPoints            = 8;
            quest.EstimatedCompletionTime = 7.5;
            quest.RealTime = 10;
            return(quest);
        }
コード例 #3
0
        public void Process(UnitHasDiedEvent eventData)
        {
            var receivingUnit = eventData.Killer;

            receivingUnit.Stats.AddExperience(eventData.Target.Stats.Experience());

            var nextLevelThreshold = ExperienceCalculator.GetExperienceRequiredForLevel(receivingUnit.Class.Level + 1);

            if (receivingUnit.Stats.Experience() >= nextLevelThreshold)
            {
                receivingUnit.Class.Level++;
                receivingUnit.Stats.RemoveExperience(nextLevelThreshold);
                EventSystem.Publish(new UnitLeveledUpEvent(receivingUnit));
            }
        }
コード例 #4
0
        private void CalculatePlayerExperience()
        {
            var localPlayer = _navigationArgs.GameData.PlayerDictionary[Settings.Alias];

            var expEarned = ExperienceCalculator.GetGameExperienceEarned(localPlayer);

            Settings.Experience += expEarned;

            var postGameRank = ExperienceCalculator.GetPlayerLevelFromExperienceTotal(expEarned);

            if ((int)postGameRank != Settings.Level)
            {
                Settings.Level = (int)postGameRank;

                //ToDo: RE-enable; Currently this throws a SystemUnauthorizedAccess exception during dialog.ShowAsync();
                //ShowLevelUpAnimation(postGameRank);
            }
        }