void ProgressDialogue() { // if the mouse button is pressed and the dialogue has started if (Input.GetMouseButtonDown(0) && dialogueStarted) { // if there is more dialogue if (dialogueIndex < currentDialogueArray.Length) { // set the new dialogue line currentDialogue = currentDialogueArray[dialogueIndex]; // increment the index dialogueIndex++; // update the UI UpdateDialogue(); // play the sound ProgressDialogueSound(); } // if the dialogue has finished else { // set npc to not talking currentTalkingNPC.NotTalking(); // deactivate the dialogue window dialogueUI.SetActive(false); // reset the index dialogueIndex = 0; } } }