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); }
public override List <DialogueChoice> GetChoices(GameObject player) { PlayerQuests playerQuests = player.GetComponent <PlayerQuests>(); List <DialogueChoice> result = new List <DialogueChoice>(); // quests foreach (ScriptableQuest quest in quests) { // can we accept this yet, or did we accept it already? // (don't show quests for level 50 if we are level 1, etc.) if (playerQuests.CanAccept(quest) || playerQuests.HasActive(quest.name)) { result.Add(new DialogueChoice( quest.name, true, (() => { // construct a new QuestDialogue for this quest and show it // (need to create runtime scriptable objects via // ScriptableObject.CreateInstance) QuestDialogue dialogue = CreateInstance <QuestDialogue>(); dialogue.quest = quest; UINpcDialogue.singleton.Show(dialogue, player); }) )); } } // trade result.Add(new DialogueChoice( tradeText, true, (() => { UIMainPanel.singleton.Show(); UINpcDialogue.singleton.Hide(); }) )); // close result.Add(new DialogueChoice(closeText, true, UINpcDialogue.singleton.Hide)); return(result); }