Example #1
0
        // loop through the active missions and determine if the previous run satisfied the mission requirements
        private MissionType CheckForCompletedMissions(bool inGame)
        {
            for (int i = 0; i < activeMissions.Length; ++i)
            {
                switch (activeMissions[i])
                {
                case MissionType.NoviceRunner:
                case MissionType.CompetentRunner:
                case MissionType.ExpertRunner:
                    if (dataManager.GetScore(false) >= dataManager.GetMissionGoal(activeMissions[i]))
                    {
                        MissionType completeMission = activeMissions[i];
                        MissionComplete(activeMissions[i]);
                        return(completeMission);
                    }
                    break;

                case MissionType.NoviceCoinCollector:
                case MissionType.CompetentCoinCollector:
                case MissionType.ExpertCoinCollector:
                    if (dataManager.GetLevelCoins(true) >= dataManager.GetMissionGoal(activeMissions[i]))
                    {
                        MissionType completeMission = activeMissions[i];
                        MissionComplete(activeMissions[i]);
                        return(completeMission);
                    }
                    break;

                case MissionType.NovicePlayCount:
                case MissionType.CompetentPlayCount:
                case MissionType.ExpertPlayCount:
                    // play count doesn't get incremented until after CheckForCompletedMissions is called
                    if (dataManager.GetPlayCount() + (inGame ? 0 : 1) >= dataManager.GetMissionGoal(activeMissions[i]))
                    {
                        MissionType completeMission = activeMissions[i];
                        MissionComplete(activeMissions[i]);
                        return(completeMission);
                    }
                    break;
                }
            }
            return(MissionType.None);
        }