private void Update() { // Let the player scroll through the dialoglines. if (Input.GetKeyDown(KeyCode.Space) && endDialog) { if (npc != null && npc.CanFight) { endDialog = false; dialogIndex = 0; npc.FinishedPreCombat(); } else if (npc != null) { endDialog = false; dialogIndex = lastLineIndex; if (npc != null) { npc.FinishedPostCombat(); } } else if (item != null) { endDialog = false; dialogIndex = lastLineIndex; item.FinishedInteraction(); } AudioManager.Instance.PlayEffectClip(7); } else if (Input.GetKeyDown(KeyCode.Space) && finishedLine && !endDialog) { if (npc != null && npc.CanFight) { StartCoroutine("TextTyping", preCombatDialog.dialogs[dialogIndex].text); } else { StartCoroutine("TextTyping", dialog.dialogs[dialogIndex].text); } AudioManager.Instance.PlayEffectClip(7); } else if (Input.GetKeyDown(KeyCode.Space) && !finishedLine) { speed = 0.01f; } }