Compare commits
9 Commits
start_scen
...
questing_l
| Author | SHA1 | Date | |
|---|---|---|---|
| e8a3919321 | |||
| 576a873a02 | |||
| a9fbeef0b4 | |||
| 30d9d7f1ec | |||
| 9a62b3ad3d | |||
|
|
77aaf1e0a7 | ||
|
|
bbcb6861c8 | ||
|
|
6baef62be1 | ||
|
|
e2e4f55caa |
@@ -18,6 +18,7 @@ MonoBehaviour:
|
||||
m_strength: 10
|
||||
m_dexterity: 10
|
||||
m_intelligence: 10
|
||||
m_spawnQuestId: 1
|
||||
m_dialogueOptions:
|
||||
- text: "G\u2019day Sir, I am the fair Adena, princess of the faraway planet of
|
||||
Velarius."
|
||||
|
||||
@@ -18,6 +18,7 @@ MonoBehaviour:
|
||||
m_strength: 10
|
||||
m_dexterity: 5
|
||||
m_intelligence: 5
|
||||
m_spawnQuestId: 2
|
||||
m_dialogueOptions:
|
||||
- text: "<i>\u2026 (the cat looks at you, on her name collar you read: Adventure
|
||||
Cat)</i>"
|
||||
|
||||
@@ -18,6 +18,7 @@ MonoBehaviour:
|
||||
m_strength: 7
|
||||
m_dexterity: 7
|
||||
m_intelligence: 7
|
||||
m_spawnQuestId: 1
|
||||
m_dialogueOptions:
|
||||
- text: "Amadeus the robot, that\u2019s my name. How can I be of service? "
|
||||
bulletizedText: Amadeus.
|
||||
|
||||
@@ -18,6 +18,7 @@ MonoBehaviour:
|
||||
m_strength: 0
|
||||
m_dexterity: 0
|
||||
m_intelligence: 0
|
||||
m_spawnQuestId: 2
|
||||
m_dialogueOptions:
|
||||
- text: I am Rufus, here to help you.
|
||||
bulletizedText: Rufus.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@ using UnityEngine;
|
||||
public class AdventurerInteractable : MonoBehaviour
|
||||
{
|
||||
public DialogueController dialogueController;
|
||||
public int m_spawnQuestID = 0;
|
||||
|
||||
[SerializeField] private string m_name = string.Empty;
|
||||
// Start is called before the first frame update
|
||||
|
||||
@@ -29,10 +29,9 @@ public class DialogueController : MonoBehaviour
|
||||
Debug.Log($"DialogueController: Character {characterName} finished interviewing");
|
||||
|
||||
CharacterManager.Instance.SetInterviewed(characterName);
|
||||
|
||||
PlayerController.Instance.cameraMovement = true;
|
||||
// TODO: stop the dialogue and return to gameplay...
|
||||
// TODO: we could probably show a "Quit" button highlighted.
|
||||
|
||||
m_dialoguePanel.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void Debug_NextCharacter()
|
||||
|
||||
@@ -57,8 +57,17 @@ public class DialoguePanel : MonoBehaviour
|
||||
m_characterText.text = "Select an option...";
|
||||
|
||||
SetupCharacterSheet();
|
||||
m_characterSheet.SetName(characterData.name);
|
||||
m_characterSheet.gameObject.SetActive(true);
|
||||
|
||||
if (CharacterManager.Instance.CharacterInterviewed(characterData.name))
|
||||
{
|
||||
m_characterSheet.SetName(characterData.name);
|
||||
m_characterSheet.gameObject.SetActive(true);
|
||||
|
||||
// Hide the dialogue panel.
|
||||
gameObject.SetActive(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_questionIndexAsked.Clear();
|
||||
m_questionHolder.gameObject.SetActive(true);
|
||||
|
||||
@@ -1,18 +1,63 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
public static GameManager Instance;
|
||||
public Image fadeRect;
|
||||
public DialogueController dialogueController;
|
||||
|
||||
[SerializeField] private float m_fadeT;
|
||||
private float m_fadeTotal;
|
||||
[SerializeField] private bool m_showFade = false;
|
||||
[SerializeField] private float m_fadeDuration = 1;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("There can only be one instance of the CharacterManager class");
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
private void Update()
|
||||
{
|
||||
//Fade image towrads target
|
||||
if(m_showFade)
|
||||
{
|
||||
if (m_fadeTotal < m_fadeDuration / 2)
|
||||
{
|
||||
m_fadeT += Time.deltaTime;
|
||||
} else
|
||||
{
|
||||
m_fadeT -= Time.deltaTime;
|
||||
}
|
||||
m_fadeTotal += Time.deltaTime;
|
||||
|
||||
|
||||
if(m_fadeT < 0)
|
||||
{
|
||||
m_showFade = false;
|
||||
m_fadeT = 0;
|
||||
m_fadeTotal = 0;
|
||||
}
|
||||
|
||||
fadeRect.color = new Color(0f, 0f, 0f, Mathf.Lerp(0, 1, m_fadeT));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void FadePingPong()
|
||||
{
|
||||
m_fadeTotal = 0;
|
||||
m_showFade = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,12 @@ public class Journal : MonoBehaviour
|
||||
|
||||
private void OnMouseDown()
|
||||
{
|
||||
Debug.Log("MOUSE DOWN ON INVENTORY");
|
||||
if (GameManager.Instance.dialogueController.DialogueInProgress)
|
||||
{
|
||||
Debug.Log("Dialog in progress, not howing journal");
|
||||
return;
|
||||
}
|
||||
|
||||
m_availableAdventurers.Clear();
|
||||
foreach (var character in CharacterManager.Instance.CharacterDatas)
|
||||
{
|
||||
@@ -83,4 +88,41 @@ public class Journal : MonoBehaviour
|
||||
}
|
||||
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);
|
||||
if(success)
|
||||
{
|
||||
questPage.Find("QuestResult/NextQuest").gameObject.SetActive(true);
|
||||
questPage.Find("QuestResult/RetryQuest").gameObject.SetActive(false);
|
||||
} else
|
||||
{
|
||||
questPage.Find("QuestResult/NextQuest").gameObject.SetActive(false);
|
||||
questPage.Find("QuestResult/RetryQuest").gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
public void RetryQuest()
|
||||
{
|
||||
Debug.Log("Retrying quest");
|
||||
questPage.Find("QuestResult").gameObject.SetActive(false);
|
||||
QuestManager.Instance.RetryQuest();
|
||||
CloseJournal();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using UnityEngine;
|
||||
|
||||
public class QuestManager : MonoBehaviour
|
||||
@@ -8,8 +9,7 @@ public class QuestManager : MonoBehaviour
|
||||
public int activeQuest = 0;
|
||||
|
||||
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()
|
||||
@@ -39,6 +39,49 @@ public class QuestManager : MonoBehaviour
|
||||
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);
|
||||
}
|
||||
}
|
||||
GameManager.Instance.FadePingPong();
|
||||
}
|
||||
|
||||
public void RetryQuest()
|
||||
{
|
||||
GameManager.Instance.FadePingPong();
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
@@ -46,14 +89,16 @@ public class Quest
|
||||
{
|
||||
public string name;
|
||||
public string description;
|
||||
public string successStr;
|
||||
public string failedStr;
|
||||
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.description = _desc;
|
||||
this.failedStr = _failedStr;
|
||||
this.successStr = _successStr;
|
||||
this.strength = _strength;
|
||||
this.intelligence = _intelligence;
|
||||
this.charisma = _charisma;
|
||||
|
||||
Reference in New Issue
Block a user