quests, next line fixed

This commit is contained in:
2024-12-27 22:45:38 +05:30
parent 948bc35c9e
commit 825f15670f
6 changed files with 108 additions and 149 deletions

View File

@@ -7,6 +7,9 @@ using UnityEngine.UI;
public class npcScript : MonoBehaviour
{
public static npcScript activeNpc;
public GameObject npcPanel;
public GameObject textBtn;
public TMP_Text npcText;
@@ -36,6 +39,7 @@ public class npcScript : MonoBehaviour
IEnumerator textLoad()
{
isLoadingText = true;
Debug.Log($"Reading line {questLineIndex} from quest {activeQuest}", gameObject);
foreach (char letter in questData[activeQuest].questLines[questLineIndex].ToCharArray())
{
npcText.text += letter;
@@ -73,7 +77,7 @@ public class npcScript : MonoBehaviour
{
if (other.CompareTag("Player"))
{
Debug.Log($"Player entered into {gameObject.name}",gameObject);
if (other.transform == playerNetwork.localPlayerTransform)
{
playerNetwork pnet = playerNetwork.localPlayerTransform.GetComponent<playerNetwork>();
@@ -112,6 +116,7 @@ public class npcScript : MonoBehaviour
}
isPlayerClose = true;
activeNpc= this;
if (npcPanel.activeInHierarchy)
{
ResetTexts();
@@ -131,11 +136,16 @@ public class npcScript : MonoBehaviour
void LoadText()
{
if(!isPlayerClose){
Debug.Log("This player aint in my area", gameObject);
return;
}
npcText.text = "";
if (textLoopAsync != null)
{
StopCoroutine(textLoopAsync);
}
Debug.Log("request quest line text load",gameObject);
textLoopAsync = StartCoroutine(textLoad());
}