Exemple #1
0
    public override List <DialogueChoice> GetChoices(GameObject player)
    {
        PlayerQuests          playerQuests = player.GetComponent <PlayerQuests>();
        List <DialogueChoice> result       = new List <DialogueChoice>();

        // accept button if we can accept it
        if (playerQuests.CanAccept(quest))
        {
            result.Add(new DialogueChoice(
                           acceptText,
                           true,
                           (() => {
                playerQuests.Accept(quest);
                UINpcDialogue.singleton.Hide();
            })));
        }

        // complete button if we have this quest
        if (playerQuests.HasActive(quest.name))
        {
            result.Add(new DialogueChoice(
                           completeText,
                           playerQuests.CanComplete(quest.name),
                           (() => {
                playerQuests.Complete(quest);
                UINpcDialogue.singleton.Hide();
            })));
        }

        // reject
        result.Add(new DialogueChoice(rejectText, true, UINpcDialogue.singleton.Hide));

        return(result);
    }
Exemple #2
0
 public bool CanPlayerCompleteAnyQuestHere(PlayerQuests playerQuests)
 {
     // check manually. Linq.Any() is HEAVY(!) on GC and performance
     foreach (ScriptableQuestOffer entry in quests)
     {
         if (entry.completeHere && playerQuests.CanComplete(entry.quest.name))
         {
             return(true);
         }
     }
     return(false);
 }