Compare commits
13 Commits
character_
...
managers
| Author | SHA1 | Date | |
|---|---|---|---|
| 532d3c167a | |||
| f81ff1b192 | |||
| 8210ef30ac | |||
| 8ed8fcd04f | |||
|
|
2bb5024dfb | ||
|
|
c55f67606d | ||
|
|
988621b810 | ||
|
|
f04a485434 | ||
|
|
37d0c66887 | ||
|
|
afe6a6592a | ||
|
|
ba34c89c8b | ||
|
|
430118d0f8 | ||
| fab8aa77d7 |
File diff suppressed because it is too large
Load Diff
28
Assets/Scripts/AdventurerInteractable.cs
Normal file
28
Assets/Scripts/AdventurerInteractable.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/AdventurerInteractable.cs.meta
Normal file
11
Assets/Scripts/AdventurerInteractable.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7fa9a36f8ebb0f4fa2ea09dac222d2d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
19
Assets/Scripts/AdventurerManager.cs
Normal file
19
Assets/Scripts/AdventurerManager.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/AdventurerManager.cs.meta
Normal file
11
Assets/Scripts/AdventurerManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0025e0659889a54c8e7b136b75e4254
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class CharacterManager : MonoBehaviour
|
||||
@@ -35,4 +36,9 @@ public class CharacterManager : MonoBehaviour
|
||||
{
|
||||
m_interviewed.Add(name, true);
|
||||
}
|
||||
|
||||
public CharacterData GetCharacterDataByName(string name)
|
||||
{
|
||||
return m_characterDatas.Where(i => i.m_name == name).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,13 @@ public class DialogueController : MonoBehaviour
|
||||
|
||||
private int m_currentIndex = 0;
|
||||
|
||||
public bool DialogueInProgress => m_dialoguePanel.gameObject.activeSelf;
|
||||
|
||||
|
||||
// DEBUG - Will need replacing with the character you selected.
|
||||
private void Start()
|
||||
{
|
||||
DisplayCharacterText(CharacterManager.Instance.CharacterDatas[m_currentIndex]);
|
||||
//DisplayCharacterText(CharacterManager.Instance.CharacterDatas[m_currentIndex]);
|
||||
|
||||
m_dialoguePanel.OnQuestionsFinished += OnQuestionsFinished;
|
||||
}
|
||||
@@ -27,6 +30,7 @@ public class DialogueController : MonoBehaviour
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class DialoguePanel : MonoBehaviour
|
||||
{
|
||||
m_skipped = false;
|
||||
m_characterText.text = "";
|
||||
|
||||
m_questionIndexAsked.Clear();
|
||||
StopAllCoroutines();
|
||||
}
|
||||
|
||||
|
||||
18
Assets/Scripts/GameManager.cs
Normal file
18
Assets/Scripts/GameManager.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/GameManager.cs.meta
Normal file
11
Assets/Scripts/GameManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7d6a699566d0234aae77a22105ba6b5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
86
Assets/Scripts/Journal.cs
Normal file
86
Assets/Scripts/Journal.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -4,15 +4,24 @@ using UnityEngine;
|
||||
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
public static PlayerController Instance;
|
||||
|
||||
public Vector3 forward;
|
||||
public Camera playerCam;
|
||||
public float xLimit = 45;
|
||||
public float yLimit = 25;
|
||||
public bool cameraMovement = true;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
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
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,26 @@ using UnityEngine;
|
||||
|
||||
public class QuestManager : MonoBehaviour
|
||||
{
|
||||
public static QuestManager Instance;
|
||||
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),
|
||||
|
||||
};
|
||||
|
||||
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
|
||||
void Start()
|
||||
{
|
||||
@@ -20,11 +34,11 @@ public class QuestManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
public Quest GetActiveQuest()
|
||||
{
|
||||
|
||||
return quests[activeQuest];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
|
||||
Reference in New Issue
Block a user