예제 #1
0
        public void AddEntityType(DomainType domainType, EntityType entityType, int count = 1)
        {
            if (domainType == null || entityType == null)
            {
                return;
            }
            var fact = FindFact(domainType, entityType);

            if (fact != null)
            {
                fact.count += count;
            }
            else
            {
                facts.Add(new Fact(domainType, entityType, count));
            }
        }
 private void SetAsPrimaryInstance()
 {
     m_instance = this;
     QuestMachine.defaultQuestDialogueUI     = questDialogueUI as IQuestDialogueUI;
     QuestMachine.defaultQuestJournalUI      = questJournalUI as IQuestJournalUI;
     QuestMachine.defaultQuestAlertUI        = questAlertUI as IQuestAlertUI;
     QuestMachine.defaultQuestHUD            = questHUD as IQuestHUD;
     QuestMachine.completedQuestDialogueMode = completedQuestDialogueMode;
     QuestMachine.prettyPrintJson            = prettyPrintJson;
     QuestMachine.debug                         = debugSettings.debug;
     MessageSystem.debug                        = debugSettings.debugMessageSystem;
     QuestGenerator.detailedDebug               = debugSettings.debugQuestGenerator;
     QuestGenerator.maxSimultaneousPlanners     = generatorSettings.maxSimultaneousPlanners;
     QuestGenerator.maxGoalActionChecksPerFrame = generatorSettings.maxGoalActionChecksPerFrame;
     QuestGenerator.maxStepsPerFrame            = generatorSettings.maxStepsPerFrame;
     DomainType.SetPlayerDomainInstance(generatorSettings.defaultPlayerDomainType);
 }
예제 #3
0
        public bool ContainsFact(DomainType domainType, EntityType entityType, int min, int max)
        {
            var fact = FindFact(domainType, entityType);

            return(fact != null && min <= fact.count && fact.count <= max);
        }
예제 #4
0
 public Fact FindFact(DomainType domainType, EntityType entityType)
 {
     return(facts.Find(f => (f.domainType == domainType && f.entityType == entityType)));
 }
예제 #5
0
        private IEnumerator GenerateQuestCoroutine(QuestEntity entity, StringField group, DomainType domainType, WorldModel worldModel, bool requireReturnToComplete,
                                                   List <QuestContent> rewardsUIContents, List <RewardSystem> rewardSystems, List <Quest> existingQuests, GeneratedQuestDelegate generatedQuest,
                                                   UrgentFactSelectionMode goalSelectionMode)
        {
            this.cancel     = false;
            this.entity     = entity;
            this.group      = group;
            this.domainType = domainType;
            this.worldModel = worldModel;
            this.requireReturnToComplete = requireReturnToComplete;
            this.rewardsUIContents       = rewardsUIContents;
            this.rewardSystems           = rewardSystems;
            this.ignoreList        = GenerateIgnoreList(existingQuests);
            this.goalSelectionMode = goalSelectionMode;
            masterStepList         = new List <PlanStep>();
            goal = null;
            plan = null;
            Quest quest = null;

            worldModel.observer = new Fact(domainType, entity.entityType, 1);
            yield return(DetermineGoal());

            if (!(cancel || goal == null))
            {
                yield return(GeneratePlan());

                if (!(cancel || plan == null))
                {
                    BackfillMinimumCounterValues();
                    if (detailedDebug)
                    {
                        LogPlan(plan);
                    }
                    quest = planToQuestBuilder.ConvertPlanToQuest(entity, group, goal, motive, plan, requireReturnToComplete, rewardsUIContents, rewardSystems);
                }
            }
            generatedQuest(quest);
        }