Merge pull request #18 from JanGross/bug_fixes

bug fixes
This commit is contained in:
Amaan Shawkath
2023-07-09 13:26:37 +01:00
committed by GitHub
6 changed files with 39 additions and 3 deletions

View File

@@ -21,6 +21,12 @@ public class AdventurerInteractable : MonoBehaviour
private void OnMouseDown() private void OnMouseDown()
{ {
if (GameManager.Instance.uiManager.InputBlocked)
return;
if (GameManager.Instance.dialogueController.DialogueInProgress)
return;
PlayerController.Instance.cameraMovement = false; PlayerController.Instance.cameraMovement = false;
CharacterData character = CharacterManager.Instance.GetCharacterDataByName(m_name); CharacterData character = CharacterManager.Instance.GetCharacterDataByName(m_name);
GameManager.Instance.dialogueController.DisplayCharacterText(character); GameManager.Instance.dialogueController.DisplayCharacterText(character);

View File

@@ -14,4 +14,6 @@ public class CharacterData : ScriptableObject
[Header("The index of the dialogue relates to what question it should link too.")] [Header("The index of the dialogue relates to what question it should link too.")]
public List<Dialogue> m_dialogueOptions; public List<Dialogue> m_dialogueOptions;
public AudioSource m_typingSfx;
} }

View File

@@ -10,6 +10,7 @@ public class GameManager : MonoBehaviour
public static GameManager Instance; public static GameManager Instance;
public Image fadeRect; public Image fadeRect;
public DialogueController dialogueController; public DialogueController dialogueController;
public UIManager uiManager;
[SerializeField] private float m_fadeT; [SerializeField] private float m_fadeT;
private float m_fadeTotal; private float m_fadeTotal;
@@ -55,9 +56,6 @@ public class GameManager : MonoBehaviour
fadeRect.color = new Color(0f, 0f, 0f, Mathf.Lerp(0, 1, m_fadeT)); fadeRect.color = new Color(0f, 0f, 0f, Mathf.Lerp(0, 1, m_fadeT));
} }
} }
public void FadePingPong(Action callback = null) public void FadePingPong(Action callback = null)

View File

@@ -33,6 +33,8 @@ public class Journal : MonoBehaviour
return; return;
} }
GameManager.Instance.uiManager.BlockInput(true);
m_availableAdventurers.Clear(); m_availableAdventurers.Clear();
foreach (var character in CharacterManager.Instance.CharacterDatas) foreach (var character in CharacterManager.Instance.CharacterDatas)
{ {
@@ -57,6 +59,8 @@ public class Journal : MonoBehaviour
journal.SetActive(false); journal.SetActive(false);
adventurerPage.gameObject.SetActive(false); adventurerPage.gameObject.SetActive(false);
PlayerController.Instance.cameraMovement = true; PlayerController.Instance.cameraMovement = true;
GameManager.Instance.uiManager.BlockInput(false);
} }
public void SetJournalAdventurerPage(int id) public void SetJournalAdventurerPage(int id)

View File

@@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UIManager : MonoBehaviour
{
public bool InputBlocked => m_blocked;
private bool m_blocked = false;
public void BlockInput(bool value)
{
m_blocked = value;
}
}

View File

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