void NextDialoge() { // Increase the current dialogue, reset line and char currentDialogue++; currentLine = 0; currentChar = 0; // Check if there is no more dialogue if (currentDialogue >= Dialogues.Count) { // Stop everything and tells the game this dialogue is over StopAllCoroutines(); WSB_GameManager.SetDialogue(false); transform.gameObject.SetActive(false); return; } // Get the new dialogue to show dialogue = Dialogues[currentDialogue]; // Get the newt text to show shownLine.text = dialogue.GetText(0); // Set the side of the character image CheckSide(); // Play the next line playLine = StartCoroutine(PlayLine()); }
private void OnTriggerExit2D(Collider2D collision) { if (collision.GetComponent <WSB_Ban>()) { // Stocks ban left the trigger of the PNJ banIn = false; // Unbind StartDialogue method of ban's Use action actionBan.FindAction("Interact").performed -= StartDialogue; } if (collision.GetComponent <WSB_Lux>()) { // Stocks lux left the trigger of the PNJ luxIn = false; // Unbind StartDialogue method of lux's Use action actionLux.FindAction("Interact").performed -= StartDialogue; } // If both Lux and Ban aren't in the PNJ trigger disable the dialogue and tells the gamemanager if (!banIn && !luxIn) { dialogue.gameObject.SetActive(false); WSB_GameManager.SetDialogue(false); } }
void StartDialogue(InputAction.CallbackContext obj) { // Exit if game paused or dialogue isn't set if (!dialogue || WSB_GameManager.Paused) { return; } // If the dialogue is already playing, skips to the next line or dialogue if (dialogue.gameObject.activeSelf) { dialogue.Skip(obj); } // If not, start a new dialogue else if (!WSB_GameManager.IsDialogue) { WSB_GameManager.SetDialogue(true); dialogue.gameObject.SetActive(true); } }