game: npc dialogue pt2

This commit is contained in:
kookiekenobi 2025-02-15 21:43:01 +08:00
parent 1570debdf2
commit abfdfb3078
2 changed files with 33 additions and 3 deletions

View file

@ -7,6 +7,7 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class GameManager : MonoBehaviour
@ -24,13 +25,26 @@ public class GameManager : MonoBehaviour
public GameObject currentNPC;
[Header("Walk Points (FOR DEBUGGING")]
/*[Header("Walk Points (FOR DEBUGGING")]
public Transform[] frontWalkPoints;
public Transform[] leftWalkPoints;
public Transform[] rightWalkPoints;
public GameObject leftWalkPointSet;
public GameObject rightWalkPointSet;
public GameObject rightWalkPointSet;*/
[Header("NPC Dialogue")]
public TextMeshProUGUI initialStatementText;
public TextMeshProUGUI playerQuestionOneText;
public TextMeshProUGUI playerQuestionTwoText;
public TextMeshProUGUI playerQuestionThreeText;
public TextMeshProUGUI npcAnswerOneText;
public TextMeshProUGUI npcAnswerTwoText;
public TextMeshProUGUI npcAnswerThreeText;
public TextMeshProUGUI playerResponse;
/// <summary>
/// Do Not Destroy on Load

View file

@ -21,7 +21,8 @@ public class NpcMovementRework : MonoBehaviour
private static readonly int IsSitting = Animator.StringToHash("isSitting");
private static readonly int Speed = Animator.StringToHash("Speed");
NpcData npcData;
public void Update()
{
if (agent.velocity.magnitude > 0.1)
@ -105,4 +106,19 @@ public class NpcMovementRework : MonoBehaviour
var random = Random.Range(0, NpcManager.instance.despawnPoints.Length);
agent.SetDestination(NpcManager.instance.despawnPoints[random].position);
}
public void LoadNPCDialogue()
{
GameManager.instance.initialStatementText.text = npcData.initialStatement;
GameManager.instance.playerQuestionOneText.text = npcData.question1;
GameManager.instance.playerQuestionTwoText.text = npcData.question2;
GameManager.instance.playerQuestionThreeText.text = npcData.question3;
GameManager.instance.npcAnswerOneText.text = npcData.answer1;
GameManager.instance.npcAnswerTwoText.text = npcData.answer2;
GameManager.instance.npcAnswerThreeText.text = npcData.answer3;
GameManager.instance.playerResponse.text = npcData.response3;
}
}