usable with only 'e'
This commit is contained in:
parent
69cfb630d2
commit
7c953a442a
|
@ -14,26 +14,32 @@ public class NPCDialogue : MonoBehaviour
|
|||
|
||||
public float wordSpeed;
|
||||
public bool playerIsClose;
|
||||
|
||||
bool isTyping = false;
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(Input.GetKeyDown(KeyCode.E) && playerIsClose) {
|
||||
if(Input.GetKeyDown(KeyCode.E) && playerIsClose && isTyping == false) {
|
||||
if (dialoguePanel.activeInHierarchy) {
|
||||
zeroText();
|
||||
// zeroText();
|
||||
NextLine();
|
||||
} else {
|
||||
dialoguePanel.SetActive(true);
|
||||
contButton.SetActive(false);
|
||||
StartCoroutine(Typing());
|
||||
}
|
||||
}
|
||||
|
||||
if(dialogueText.text == dialogue[index]) {
|
||||
contButton.SetActive(true);
|
||||
isTyping = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void zeroText() {
|
||||
dialogueText.text = "";
|
||||
index = 0;
|
||||
isTyping = false;
|
||||
dialoguePanel.SetActive(false);
|
||||
}
|
||||
|
||||
|
@ -45,11 +51,11 @@ public class NPCDialogue : MonoBehaviour
|
|||
}
|
||||
|
||||
public void NextLine () {
|
||||
|
||||
contButton.SetActive(false);
|
||||
if (index < dialogue.Length - 1) {
|
||||
index++;
|
||||
dialogueText.text = "";
|
||||
isTyping = true;
|
||||
StartCoroutine(Typing());
|
||||
} else {
|
||||
zeroText();
|
||||
|
|
Loading…
Reference in New Issue