예제 #1
0
    /* *************************************************************************************
    * private void FindLeader()
    *      Given a current quest, finds a list of the best quest for this particular group
    *      of players
    *
    * Parameters
    *      QuestManager.Quest currentQuest - The current active quest.
    * Return
    *      sampleSpace[randomQuest].questID - The id of the next quest to become active
    * *************************************************************************************/
    public int GetBestQuest(QuestManager.Quest currentQuest)
    {
        UpdatePlayers();
        FindLeader();
        List <QuestManager.Quest> sampleSpace = GenerateSampleSpace(currentQuest);


        //print("BAFFAALG_GETBESTQUEST currentQuest.nextQuests.Count = " + currentQuest.nextQuests.Count);
        int randomQuest = Random.Range(0, sampleSpace.Count);

        return(sampleSpace[randomQuest].questID);
    }
예제 #2
0
    public void CreateCenario(QuestManager.Quest newQuest)
    {
        foreach (GameObject item in GameObject.FindGameObjectsWithTag(GameManagerScript.Tags.Item.ToString()))
        {
            Destroy(item);
        }
        foreach (GameObject item in GameObject.FindGameObjectsWithTag(GameManagerScript.Tags.SafeHaven.ToString()))
        {
            Destroy(item);
        }
        foreach (GameObject enemy in enemies)
        {
            Destroy(enemy);
        }
        foreach (GameObject victim in victims)
        {
            Destroy(victim);
        }
        enemies.Clear();
        victims.Clear();

        if (newQuest.questID != 99)
        {
            CreateTerrain();
            CreateEnemies(newQuest.numEnemies);
            CreateVictims(newQuest.numVictims);
            CreateItems(newQuest.numItems);
            CreateObjective(newQuest.numObjectives);
            SetPlayers();
        }
        else
        {
            EndGame();
        }

        UIManagerScript.GetInstance().StartDisplayOnScreen(currentTerrain, newQuest.questName, null);
    }
예제 #3
0
    public bool isTalkingQuest = false; //denotes whether or not this quest is used to communicate with other NPCs

    void FinishQuest(QuestManager.Quest thisQuest)
    {
        QuestManager.instance.completedQuests.Add(thisQuest);
        isTalkingQuest = false;
    }
예제 #4
0
    /* *************************************************************************************
    * private List<QuestManager.Quest> GenerateSampleSpace(QuestManager.Quest currentQuest)
    *      This method filter the currentQuest list of nextQuests (possible quests following the current)
    *      and generates a list with the best candidates for the next quest
    *
    * Parameters
    *      currentQuest - The currentQuest of the game
    *
    * Return
    *      List<QuestManager.Quest> - a subset of currentQuest.nextQuests filtered by the leaders preference
    *
    *  OBS
    *      It was stipulated that, for a leader with openness < 4 (30% or lower) the players preferences
    *      would be as follows:
    *          Considering the intensities for each aspect of a quest
    *          (enemyIntensity, victimIntensity, objectiveIntensity) and the levels of each player type
    *          (agression, rescuer, greed) the interest table would be:
    *
    *              intensities
    *       /      None    Low    Medium  High
    * t     0       v       x        x     x
    * y     25%     v       v        x     x
    * p     50%     v       v        v     v
    * e     75%     x       x        v     v
    *       100%    x       x        x     v
    *
    *       Where v represents that a player is willing to perform quests with this intensity of *aspect*
    *       and x represents an unwillingness to perform said quest
    *
    * *************************************************************************************/
    private List <QuestManager.Quest> GenerateSampleSpace(QuestManager.Quest currentQuest)
    {
        List <QuestManager.Quest> sampleSpace = new List <QuestManager.Quest>();

        print("currentQuest.nextQuests.count = " + currentQuest.nextQuests.Count);
        if (leader.O < 4)
        {
            foreach (QuestManager.Quest quest in currentQuest.nextQuests)
            {
                switch (leader.agression)
                {
                case 1:
                    if (quest.enemyIntensity > QuestManager.Intensity.Low)
                    {
                        continue;
                    }
                    break;

                case 2:
                    if (quest.enemyIntensity > QuestManager.Intensity.Medium)
                    {
                        continue;
                    }
                    break;

                case 3:
                    break;

                case 4:
                    if (quest.enemyIntensity < QuestManager.Intensity.Medium)
                    {
                        continue;
                    }
                    break;

                case 5:
                    print(quest.questID + "->" + quest.enemyIntensity.ToString());
                    if (quest.enemyIntensity < QuestManager.Intensity.High)
                    {
                        print("continue");
                        continue;
                    }
                    break;
                }
                switch (leader.rescuer)
                {
                case 1:
                    print(quest.questID + "->" + quest.victimIntensity.ToString());
                    if (quest.victimIntensity > QuestManager.Intensity.Low)
                    {
                        print("continue");
                        continue;
                    }
                    break;

                case 2:
                    if (quest.victimIntensity > QuestManager.Intensity.Medium)
                    {
                        continue;
                    }
                    break;

                case 3:
                    break;

                case 4:
                    if (quest.victimIntensity < QuestManager.Intensity.Medium)
                    {
                        continue;
                    }
                    break;

                case 5:
                    if (quest.victimIntensity < QuestManager.Intensity.High)
                    {
                        continue;
                    }
                    break;
                }
                switch (leader.greed)
                {
                case 1:
                    if (quest.objectiveIntensity > QuestManager.Intensity.None)
                    {
                        continue;
                    }
                    break;

                case 2:
                    if (quest.objectiveIntensity > QuestManager.Intensity.Low)
                    {
                        continue;
                    }
                    break;

                case 3:
                    break;

                case 4:
                    if (quest.objectiveIntensity < QuestManager.Intensity.Medium)
                    {
                        continue;
                    }
                    break;

                case 5:
                    print(quest.questID + "->" + quest.objectiveIntensity.ToString());
                    if (quest.objectiveIntensity < QuestManager.Intensity.High)
                    {
                        print("continue");
                        continue;
                    }
                    break;
                }
                print("Added");
                sampleSpace.Add(quest);
            }
        }
        else
        {
            //Need to work on filtering the quests presented to players who are open to new experiences
            //(how much does a open player, who doesn't like aggressive games, would like to be presented with
            // aggressive games)
            sampleSpace = currentQuest.nextQuests;
        }
        print("SampleSpace.count = " + sampleSpace.Count);
        return(sampleSpace);
    }