game: added randomized debug dialogue
This commit is contained in:
parent
05eab3e08f
commit
d7e0577c42
2 changed files with 27 additions and 7 deletions
|
@ -900,7 +900,8 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
paperObject: {fileID: 1179830388}
|
||||
navigationTxt: {fileID: 32539959}
|
||||
navigationTxtBubble: {fileID: 32539959}
|
||||
navigationTxt: {fileID: 726703123}
|
||||
--- !u!1 &711059148
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1024,7 +1025,7 @@ MonoBehaviour:
|
|||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: I want to go left!
|
||||
m_text:
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
|
@ -1264,7 +1265,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!4 &1179830389
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -8,28 +8,47 @@
|
|||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class NPCBehaviour : MonoBehaviour
|
||||
{
|
||||
private NPCMovement npcMoveScript;
|
||||
[SerializeField] private GameObject paperObject;
|
||||
[SerializeField] private GameObject navigationTxt;
|
||||
[SerializeField] private GameObject navigationTxtBubble;
|
||||
[SerializeField] TextMeshProUGUI navigationTxt;
|
||||
|
||||
private string[] possibleSentences =
|
||||
{
|
||||
"I want to go left!",
|
||||
"I want to go right!"
|
||||
};
|
||||
|
||||
void Start()
|
||||
{
|
||||
npcMoveScript = GetComponent<NPCMovement>();
|
||||
|
||||
paperObject.SetActive(false);
|
||||
navigationTxt.SetActive(false);
|
||||
navigationTxtBubble.SetActive(false);
|
||||
|
||||
if (navigationTxt != null)
|
||||
{
|
||||
navigationTxt.text = GetRandomSentence();
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (npcMoveScript.inFrontOfPlayer == true)
|
||||
{
|
||||
paperObject.SetActive(true);
|
||||
navigationTxt.SetActive(true);
|
||||
//paperObject.SetActive(true);
|
||||
navigationTxtBubble.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
string GetRandomSentence()
|
||||
{
|
||||
int n = Random.Range(0, possibleSentences.Length);
|
||||
return possibleSentences[n];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue