コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
ファイル: QuestsHandler.cs プロジェクト: SwimUp/moreevents
        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);
        }