Пример #1
0
        public static Quest GenerateNewQuest()
        {
            ObstacleType goal     = ChallengeTypes.Goals.getRandom(rand);
            IDeepGoal    deepGoal = Main.instance.player.getActiveDeepGoal();

            if (!deepGoal.isActive())
            {
                deepGoal = DeepGoalsTypes.NONE;
            }
            if (rand.Next(4) == 0 && deepGoal.minQuestDifficulty() <= StatisticsTracker.maxQuestDifficulty.value)
            {
                //Debug.Log(Main.instance.player.getActiveDeepGoal().name);
                if (!QuestManager.availableQuests.Any(x => x.originalGoal == deepGoal.getQuestType()) &&
                    !QuestManager.activeQuests.Any(x => x.originalGoal == deepGoal.getQuestType()))
                {
                    goal = deepGoal.getQuestType();
                }
            }
            FantasyName[] names = fantasyNameGenerator.GetFantasyNames(1);
            Quest         quest = GenerateNewQuest(goal, names[0].FirstName + " " + names[0].Land);

            if (goal == deepGoal.getQuestType())
            {
                deepGoal.modifyQuest(quest);
            }
            return(quest);
        }
Пример #2
0
        public static void deserialize(ref SerializationInfo info, ref StreamingContext context)
        {
            SerializationInfoEnumerator infoEnum = info.GetEnumerator();
            Hashtable values = new Hashtable();

            while (infoEnum.MoveNext())
            {
                SerializationEntry val = infoEnum.Current;
                values.Add(val.Name, val.Value);
            }
            foreach (IDeepGoal s in allDeepGoals)
            {
                s.deserialize(values);
            }
            if (values.Contains("recentlyActive"))
            {
                string ra = values["recentlyActive"] as string;
                if (!ra.Equals("null"))
                {
                    recentlyActive = allDeepGoals.Find(x => x.name == ra);
                }
            }
        }
Пример #3
0
 public static IDeepGoal getFirstActiveGoal()
 {
     if (recentlyActive != null && !recentlyActive.isActive())
     {
         return(recentlyActive);
     }
     foreach (IDeepGoal goal in allDeepGoals)
     {
         if (goal != NONE && goal.isActive())
         {
             if (recentlyActive == null)
             {
                 recentlyActive = goal;
             }
             else if (goal != recentlyActive)
             {
                 return(recentlyActive);
             }
             return(goal);
         }
     }
     return(NONE);
 }
Пример #4
0
 public static void clearActiveGoal()
 {
     recentlyActive = null;
 }
Пример #5
0
 public static void register(IDeepGoal goal)
 {
     allDeepGoals.Add(goal);
 }