Implemet quest completion
This commit is contained in:
@@ -18,6 +18,7 @@ MonoBehaviour:
|
|||||||
m_strength: 10
|
m_strength: 10
|
||||||
m_dexterity: 10
|
m_dexterity: 10
|
||||||
m_intelligence: 10
|
m_intelligence: 10
|
||||||
|
m_spawnQuestId: 1
|
||||||
m_dialogueOptions:
|
m_dialogueOptions:
|
||||||
- text: "G\u2019day Sir, I am the fair Adena, princess of the faraway planet of
|
- text: "G\u2019day Sir, I am the fair Adena, princess of the faraway planet of
|
||||||
Velarius."
|
Velarius."
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ MonoBehaviour:
|
|||||||
m_strength: 10
|
m_strength: 10
|
||||||
m_dexterity: 5
|
m_dexterity: 5
|
||||||
m_intelligence: 5
|
m_intelligence: 5
|
||||||
|
m_spawnQuestId: 2
|
||||||
m_dialogueOptions:
|
m_dialogueOptions:
|
||||||
- text: "<i>\u2026 (the cat looks at you, on her name collar you read: Adventure
|
- text: "<i>\u2026 (the cat looks at you, on her name collar you read: Adventure
|
||||||
Cat)</i>"
|
Cat)</i>"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ MonoBehaviour:
|
|||||||
m_strength: 7
|
m_strength: 7
|
||||||
m_dexterity: 7
|
m_dexterity: 7
|
||||||
m_intelligence: 7
|
m_intelligence: 7
|
||||||
|
m_spawnQuestId: 1
|
||||||
m_dialogueOptions:
|
m_dialogueOptions:
|
||||||
- text: "Amadeus the robot, that\u2019s my name. How can I be of service? "
|
- text: "Amadeus the robot, that\u2019s my name. How can I be of service? "
|
||||||
bulletizedText: Amadeus.
|
bulletizedText: Amadeus.
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ MonoBehaviour:
|
|||||||
m_strength: 0
|
m_strength: 0
|
||||||
m_dexterity: 0
|
m_dexterity: 0
|
||||||
m_intelligence: 0
|
m_intelligence: 0
|
||||||
|
m_spawnQuestId: 2
|
||||||
m_dialogueOptions:
|
m_dialogueOptions:
|
||||||
- text: I am Rufus, here to help you.
|
- text: I am Rufus, here to help you.
|
||||||
bulletizedText: Rufus.
|
bulletizedText: Rufus.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@ using UnityEngine;
|
|||||||
public class AdventurerInteractable : MonoBehaviour
|
public class AdventurerInteractable : MonoBehaviour
|
||||||
{
|
{
|
||||||
public DialogueController dialogueController;
|
public DialogueController dialogueController;
|
||||||
|
public int m_spawnQuestID = 0;
|
||||||
|
|
||||||
[SerializeField] private string m_name = string.Empty;
|
[SerializeField] private string m_name = string.Empty;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
|
|||||||
@@ -88,4 +88,23 @@ public class Journal : MonoBehaviour
|
|||||||
}
|
}
|
||||||
SetJournalAdventurerPage(m_selectedAdventurer);
|
SetJournalAdventurerPage(m_selectedAdventurer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AssignAdventurer()
|
||||||
|
{
|
||||||
|
Quest activeQuest = QuestManager.Instance.GetActiveQuest();
|
||||||
|
bool success = QuestManager.Instance.RunQuestWithAdventurer(m_availableAdventurers[m_selectedAdventurer], activeQuest);
|
||||||
|
Debug.Log("THE QUESTR ESULT WAS: " + success);
|
||||||
|
adventurerPage.gameObject.SetActive(false);
|
||||||
|
questPage.Find("QuestResult/QuestResultText").gameObject.GetComponent<TMP_Text>().text = success ? activeQuest.successStr : activeQuest.failedStr;
|
||||||
|
questPage.Find("QuestResult").gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartNextQuest()
|
||||||
|
{
|
||||||
|
Debug.Log("Starting next day");
|
||||||
|
questPage.Find("QuestResult").gameObject.SetActive(false);
|
||||||
|
QuestManager.Instance.NextQuest();
|
||||||
|
CloseJournal();
|
||||||
|
Debug.Log("Started next quest");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class QuestManager : MonoBehaviour
|
public class QuestManager : MonoBehaviour
|
||||||
@@ -8,8 +9,7 @@ public class QuestManager : MonoBehaviour
|
|||||||
public int activeQuest = 0;
|
public int activeQuest = 0;
|
||||||
|
|
||||||
public Quest[] quests = {
|
public Quest[] quests = {
|
||||||
new Quest(_name: "Advert Quest 1", _desc: "Find someone to hand out flyers to advertise our tavern to adventurers. Strength, dexterity, intelligence: doesn<73>t matter, find someone who would do this for as little money as possible.", _failedStr: "Damn, that didn<64>t work at all. That robot just randomly started playing an instrument, much to the dismay of the townspeople.", _strength: 0, _intelligence: 0, _charisma: 5),
|
new Quest(_name: "Advert Quest 1", _desc: "Find someone to hand out flyers to advertise our tavern to adventurers. Strength, dexterity, intelligence: doesn<73>t matter, find someone who would do this for as little money as possible.", _failedStr: "Damn, that didn<64>t work at all. That robot just randomly started playing an instrument, much to the dismay of the townspeople.", _successStr: "Perfect, this place will be full of adventurers in no time.", _strength: 0, _intelligence: 0, _charisma: 5),
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
@@ -39,6 +39,43 @@ public class QuestManager : MonoBehaviour
|
|||||||
return quests[activeQuest];
|
return quests[activeQuest];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool RunQuestWithAdventurer(CharacterData characterData, Quest quest)
|
||||||
|
{
|
||||||
|
if (characterData.m_charisma < quest.charisma)
|
||||||
|
{
|
||||||
|
Debug.Log("Character failed charisma check");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (characterData.m_strength < quest.strength)
|
||||||
|
{
|
||||||
|
Debug.Log("Character failed strength check");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (characterData.m_intelligence < quest.intelligence)
|
||||||
|
{
|
||||||
|
Debug.Log("Character failed intlligence check");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NextQuest()
|
||||||
|
{
|
||||||
|
activeQuest++;
|
||||||
|
if (activeQuest >= quests.Length)
|
||||||
|
{
|
||||||
|
Debug.Log("All quests completed");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var adventurer in Resources.FindObjectsOfTypeAll<AdventurerInteractable>())
|
||||||
|
{
|
||||||
|
if (adventurer.m_spawnQuestID == activeQuest)
|
||||||
|
{
|
||||||
|
adventurer.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
@@ -46,14 +83,16 @@ public class Quest
|
|||||||
{
|
{
|
||||||
public string name;
|
public string name;
|
||||||
public string description;
|
public string description;
|
||||||
|
public string successStr;
|
||||||
public string failedStr;
|
public string failedStr;
|
||||||
public int strength, intelligence, charisma;
|
public int strength, intelligence, charisma;
|
||||||
|
|
||||||
public Quest(string _name, string _desc, string _failedStr, int _strength, int _intelligence, int _charisma)
|
public Quest(string _name, string _desc, string _failedStr, string _successStr, int _strength, int _intelligence, int _charisma)
|
||||||
{
|
{
|
||||||
this.name = _name;
|
this.name = _name;
|
||||||
this.description = _desc;
|
this.description = _desc;
|
||||||
this.failedStr = _failedStr;
|
this.failedStr = _failedStr;
|
||||||
|
this.successStr = _successStr;
|
||||||
this.strength = _strength;
|
this.strength = _strength;
|
||||||
this.intelligence = _intelligence;
|
this.intelligence = _intelligence;
|
||||||
this.charisma = _charisma;
|
this.charisma = _charisma;
|
||||||
|
|||||||
Reference in New Issue
Block a user