9 Commits

Author SHA1 Message Date
e8a3919321 Add retry quest option 2023-07-09 10:25:52 +02:00
576a873a02 Add pingpong fade 2023-07-09 10:25:40 +02:00
a9fbeef0b4 Implemet quest completion 2023-07-09 00:10:43 +02:00
30d9d7f1ec Fix journal opening during dialog 2023-07-08 23:01:49 +02:00
9a62b3ad3d Fix journal UI scaling 2023-07-08 22:46:27 +02:00
Amaan Shawkath
77aaf1e0a7 Merge pull request #7 from JanGross/character_panel_tweaks
Character panel tweaks
2023-07-08 21:37:01 +01:00
Amaan Shawkath
bbcb6861c8 Hiding dialogue once its finished 2023-07-08 21:33:03 +01:00
Amaan Shawkath
6baef62be1 Updated character sheet so it only displays when the dialogue has been completed 2023-07-08 21:32:46 +01:00
Amaan Shawkath
e2e4f55caa Merge pull request #6 from JanGross/start_scene_and_tweak
Start scene and tweak
2023-07-08 21:19:32 +01:00
11 changed files with 1569 additions and 101 deletions

View File

@@ -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."

View File

@@ -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>"

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -29,10 +29,9 @@ public class DialogueController : MonoBehaviour
Debug.Log($"DialogueController: Character {characterName} finished interviewing"); Debug.Log($"DialogueController: Character {characterName} finished interviewing");
CharacterManager.Instance.SetInterviewed(characterName); CharacterManager.Instance.SetInterviewed(characterName);
PlayerController.Instance.cameraMovement = true; 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() public void Debug_NextCharacter()

View File

@@ -57,9 +57,18 @@ public class DialoguePanel : MonoBehaviour
m_characterText.text = "Select an option..."; m_characterText.text = "Select an option...";
SetupCharacterSheet(); SetupCharacterSheet();
if (CharacterManager.Instance.CharacterInterviewed(characterData.name))
{
m_characterSheet.SetName(characterData.name); m_characterSheet.SetName(characterData.name);
m_characterSheet.gameObject.SetActive(true); m_characterSheet.gameObject.SetActive(true);
// Hide the dialogue panel.
gameObject.SetActive(false);
return;
}
m_questionIndexAsked.Clear(); m_questionIndexAsked.Clear();
m_questionHolder.gameObject.SetActive(true); m_questionHolder.gameObject.SetActive(true);
gameObject.SetActive(true); gameObject.SetActive(true);

View File

@@ -1,18 +1,63 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
public class GameManager : MonoBehaviour public class GameManager : MonoBehaviour
{ {
// Start is called before the first frame update public static GameManager Instance;
void Start() 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)
}
// Update is called once per frame
void Update()
{ {
Instance = this;
}
else
{
Debug.LogWarning("There can only be one instance of the CharacterManager class");
}
}
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;
}
} }

View File

@@ -27,7 +27,12 @@ public class Journal : MonoBehaviour
private void OnMouseDown() 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(); m_availableAdventurers.Clear();
foreach (var character in CharacterManager.Instance.CharacterDatas) foreach (var character in CharacterManager.Instance.CharacterDatas)
{ {
@@ -83,4 +88,41 @@ 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);
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();
}
} }

View File

@@ -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,49 @@ 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);
}
}
GameManager.Instance.FadePingPong();
}
public void RetryQuest()
{
GameManager.Instance.FadePingPong();
}
} }
[System.Serializable] [System.Serializable]
@@ -46,14 +89,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;