10 Commits

Author SHA1 Message Date
Amaan Shawkath
ab1c3d1e26 removing gameobjects folder and moving character manager 2023-07-08 18:54:36 +01:00
Amaan Shawkath
4697a647ef Adding in the characters
Added debug buttons to cycle through the characters
Bug fixes
2023-07-08 18:50:49 +01:00
Amaan Shawkath
7ab1e2cf4c Cleaning up using statements 2023-07-08 18:17:07 +01:00
Amaan Shawkath
ae768baaaa Added image attribute to character data 2023-07-08 18:16:28 +01:00
Amaan Shawkath
4d086fd5b9 Added public getter for character sheets 2023-07-08 18:16:13 +01:00
Amaan Shawkath
c4b5d7dac3 Improved logic for character sheets
added a way to retrieve sheets for characters
2023-07-08 18:06:06 +01:00
0e5c432dd5 Add questLog interactable 2023-07-08 18:12:14 +02:00
Amaan Shawkath
3da424b722 Merge pull request #3 from JanGross/character_sheet_setup
Character sheet setup
2023-07-08 17:09:04 +01:00
Amaan Shawkath
be5e2556c6 basic setup of a character sheet - needs some more work
Wiring up character interviewed
Added property for bulletized text - ready to add when we have some
2023-07-08 17:08:45 +01:00
Amaan Shawkath
92fd23b6f0 setting up character manager 2023-07-08 17:06:32 +01:00
15 changed files with 57 additions and 2599 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AdventurerInteractable : MonoBehaviour
{
public DialogueController dialogueController;
[SerializeField] private string m_name = string.Empty;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnMouseDown()
{
PlayerController.Instance.cameraMovement = false;
CharacterData character = CharacterManager.Instance.GetCharacterDataByName(m_name);
dialogueController.DisplayCharacterText(character);
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a7fa9a36f8ebb0f4fa2ea09dac222d2d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,19 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AdventurerManager : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a0025e0659889a54c8e7b136b75e4254
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,6 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq;
using UnityEngine; using UnityEngine;
public class CharacterManager : MonoBehaviour public class CharacterManager : MonoBehaviour
@@ -36,9 +35,4 @@ public class CharacterManager : MonoBehaviour
{ {
m_interviewed.Add(name, true); m_interviewed.Add(name, true);
} }
public CharacterData GetCharacterDataByName(string name)
{
return m_characterDatas.Where(i => i.m_name == name).FirstOrDefault();
}
} }

View File

@@ -8,20 +8,17 @@ public class DialogueController : MonoBehaviour
private int m_currentIndex = 0; private int m_currentIndex = 0;
public bool DialogueInProgress => m_dialoguePanel.gameObject.activeSelf;
// DEBUG - Will need replacing with the character you selected. // DEBUG - Will need replacing with the character you selected.
private void Start() private void Start()
{ {
//DisplayCharacterText(CharacterManager.Instance.CharacterDatas[m_currentIndex]); DisplayCharacterText(CharacterManager.Instance.CharacterDatas[m_currentIndex]);
m_dialoguePanel.OnQuestionsFinished += OnQuestionsFinished; m_dialoguePanel.OnQuestionsFinished += OnQuestionsFinished;
} }
public void DisplayCharacterText(CharacterData character) public void DisplayCharacterText(CharacterData character)
{ {
m_dialoguePanel.Setup(character); m_dialoguePanel.Setup(character);
} }
public void OnQuestionsFinished(string characterName) public void OnQuestionsFinished(string characterName)
@@ -30,7 +27,6 @@ public class DialogueController : MonoBehaviour
CharacterManager.Instance.SetInterviewed(characterName); CharacterManager.Instance.SetInterviewed(characterName);
PlayerController.Instance.cameraMovement = true;
// TODO: stop the dialogue and return to gameplay... // TODO: stop the dialogue and return to gameplay...
// TODO: we could probably show a "Quit" button highlighted. // TODO: we could probably show a "Quit" button highlighted.
} }

View File

@@ -81,7 +81,7 @@ public class DialoguePanel : MonoBehaviour
{ {
m_skipped = false; m_skipped = false;
m_characterText.text = ""; m_characterText.text = "";
m_questionIndexAsked.Clear();
StopAllCoroutines(); StopAllCoroutines();
} }

View File

@@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a7d6a699566d0234aae77a22105ba6b5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,86 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
public class Journal : MonoBehaviour
{
public GameObject journal;
private List<CharacterData> m_availableAdventurers = new List<CharacterData>();
public Transform adventurerPage;
public Transform questPage;
private int m_selectedAdventurer = 0;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnMouseDown()
{
Debug.Log("MOUSE DOWN ON INVENTORY");
m_availableAdventurers.Clear();
foreach (var character in CharacterManager.Instance.CharacterDatas)
{
if (CharacterManager.Instance.CharacterInterviewed(character.name)) {
Debug.Log("Available Adventurer:" + character.name);
m_availableAdventurers.Add(character);
}
}
SetJournalQuestPage();
if (m_availableAdventurers.Count > 0)
{
SetJournalAdventurerPage(m_selectedAdventurer);
adventurerPage.gameObject.SetActive(true);
}
journal.SetActive(true);
PlayerController.Instance.cameraMovement = false;
}
public void CloseJournal()
{
journal.SetActive(false);
adventurerPage.gameObject.SetActive(false);
PlayerController.Instance.cameraMovement = true;
}
public void SetJournalAdventurerPage(int id)
{
CharacterData chara = m_availableAdventurers[id];
TMP_Text nameLabel = adventurerPage.Find("AdventurerName").gameObject.GetComponent<TMP_Text>();
nameLabel.text = chara.m_name;
}
public void SetJournalQuestPage()
{
Quest quest = QuestManager.Instance.GetActiveQuest();
questPage.Find("QuestName").gameObject.GetComponent<TMP_Text>().text = quest.name;
questPage.Find("QuestDescription").gameObject.GetComponent<TMP_Text>().text = quest.description;
}
public void NextAdventurer()
{
m_selectedAdventurer = ++m_selectedAdventurer % m_availableAdventurers.Count();
SetJournalAdventurerPage(m_selectedAdventurer);
}
public void PreviousAdventurer()
{
m_selectedAdventurer = --m_selectedAdventurer;
if (m_selectedAdventurer < 0)
{
m_selectedAdventurer = m_availableAdventurers.Count() - 1;
}
SetJournalAdventurerPage(m_selectedAdventurer);
}
}

View File

@@ -4,24 +4,15 @@ using UnityEngine;
public class PlayerController : MonoBehaviour public class PlayerController : MonoBehaviour
{ {
public static PlayerController Instance;
public Vector3 forward; public Vector3 forward;
public Camera playerCam; public Camera playerCam;
public float xLimit = 45; public float xLimit = 45;
public float yLimit = 25; public float yLimit = 25;
public bool cameraMovement = true; public bool cameraMovement = true;
// Start is called before the first frame update
private void Awake() void Start()
{ {
if (Instance == null)
{
Instance = this;
}
else
{
Debug.LogWarning("There can only be one instance of the CharacterManager class");
}
} }
// Update is called once per frame // Update is called once per frame

View File

@@ -0,0 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class QuestLogInteractable : MonoBehaviour
{
public GameObject journal;
public PlayerController playerController;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnMouseDown()
{
Debug.Log("MOUSE DOWN ON INVENTORY");
journal.SetActive(true);
playerController.cameraMovement = false;
}
public void CloseJournal()
{
Cursor.lockState = CursorLockMode.Locked;
journal.SetActive(false);
playerController.cameraMovement = true;
}
}

View File

@@ -4,26 +4,12 @@ using UnityEngine;
public class QuestManager : MonoBehaviour public class QuestManager : MonoBehaviour
{ {
public static QuestManager Instance;
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.", _strength: 0, _intelligence: 0, _charisma: 5),
}; };
private void Awake()
{
if (Instance == null)
{
Instance = this;
}
else
{
Debug.LogWarning("There can only be one instance of the CharacterManager class");
}
}
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
@@ -34,11 +20,11 @@ public class QuestManager : MonoBehaviour
} }
} }
public Quest GetActiveQuest() // Update is called once per frame
void Update()
{ {
return quests[activeQuest];
} }
} }
[System.Serializable] [System.Serializable]