public void TryGenerateQuests()
        {
            int questCount = Rand.RangeInclusive(1, 2);

            for (int i = 0; i < questCount; i++)
            {
                int            questId = Rand.Range(0, questsList.Length);
                QuestRim.Quest quest   = (QuestRim.Quest)Activator.CreateInstance(questsList[questId]);
                if (quest.TryGiveQuestTo(null, null))
                {
                    Quests.Add(quest);
                }
            }
        }
Esempio n. 2
0
        public static bool TryGiveQuestTo(Pawn pawn, QuestDef questDef)
        {
            Quest quest = (Quest)Activator.CreateInstance(questDef.Quest);

            if (quest.TryGiveQuestTo(pawn, questDef))
            {
                FiringIncident inc = new FiringIncident
                {
                    def   = questDef.Incident,
                    parms = new IncidentParms()
                    {
                        forced = false,
                        target = Find.World
                    }
                };
                Find.World.StoryState.Notify_IncidentFired(inc);

                return(true);
            }

            return(false);
        }