scene transition fixes
This commit is contained in:
@@ -11,8 +11,8 @@ public class DialogueManager : MonoBehaviour
|
||||
public TextMeshProUGUI nameText;
|
||||
public TextMeshProUGUI dialogueText;
|
||||
|
||||
public TextMeshProUGUI itemText;
|
||||
public GameObject pickupHint;
|
||||
public TextMeshProUGUI itemText; // displays name of nearby item
|
||||
public TextMeshProUGUI pickupHint; // tells the player to press 'E' to pickup
|
||||
|
||||
public Animator animator;
|
||||
|
||||
@@ -22,6 +22,15 @@ void Start()
|
||||
sentences = new Queue<string>();
|
||||
}
|
||||
|
||||
public void ReloadReferences()
|
||||
{
|
||||
nameText = GameObject.FindWithTag("DialogNameText").GetComponent<TextMeshProUGUI>();
|
||||
dialogueText = GameObject.FindWithTag("DialogMessageText").GetComponent<TextMeshProUGUI>();
|
||||
itemText = GameObject.FindWithTag("DialogItemText").GetComponent<TextMeshProUGUI>();
|
||||
pickupHint = GameObject.FindWithTag("ItemPickupText").GetComponent<TextMeshProUGUI>();
|
||||
animator = GameObject.FindWithTag("DialogContainer").GetComponent<Animator>();
|
||||
}
|
||||
|
||||
public void StartDialogue(Dialogue dialogue)
|
||||
{
|
||||
animator.SetBool("IsOpen", true);
|
||||
@@ -75,12 +84,12 @@ IEnumerator TypeSentence(string sentence)
|
||||
public void ShowItemText(string itemName)
|
||||
{
|
||||
itemText.text = itemName;
|
||||
pickupHint.SetActive(true);
|
||||
pickupHint.text = "Press \"E\" to pick up";
|
||||
}
|
||||
|
||||
public void HideItemText()
|
||||
{
|
||||
itemText.text = "";
|
||||
pickupHint.SetActive(false);
|
||||
pickupHint.text = "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using Unity.VectorGraphics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
@@ -46,7 +47,10 @@ private void ReloadReferences()
|
||||
blackScreen = GameObject.FindWithTag("BlackScreen").GetComponent<Image>();
|
||||
playerController = GameObject.FindWithTag("Player").GetComponent<PlayerController>();
|
||||
DialogueManager = GetComponent<DialogueManager>();
|
||||
DialogueManager.ReloadReferences();
|
||||
|
||||
Inventory = GetComponent<Inventory>();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -85,7 +89,7 @@ private IEnumerator EnterSceneDoorCoroutine(string scene, int doorId)
|
||||
// Optional: Update a loading bar with asyncLoad.progress
|
||||
yield return null;
|
||||
}
|
||||
|
||||
|
||||
ReloadReferences();
|
||||
|
||||
// Make sure screen is black in new scene
|
||||
|
||||
Reference in New Issue
Block a user