private void Awake() { Instance = this; dialogueStyle = (DialogueStyle)PlayerPrefs.GetInt("DialogueSystem_dialogueStyle", 0); isInCutscene = false; CameraScript.panning = false; }
private void Update() { if (active && sentences.Count > 0) { counter += Time.deltaTime; if ((currentPosition < sentences.Peek().Length) && ((style == DialogueStyle.slow && counter > slowLetterDuration) || (style == DialogueStyle.ultraslow && counter > ultraSlowLetterDuration) || (style == DialogueStyle.basic && counter > fastLetterDuration))) { counter = 0.0f; if (sentences.Peek().Substring(currentPosition, 1).Equals("*")) { ++currentPosition; style = style == DialogueStyle.slow ? DialogueStyle.basic : DialogueStyle.slow; } else if (sentences.Peek().Substring(currentPosition, 1).Equals("#")) { ++currentPosition; style = style == DialogueStyle.ultraslow ? DialogueStyle.basic : DialogueStyle.ultraslow; } else { currentSentence = currentSentence + sentences.Peek().Substring(currentPosition, 1); ++currentPosition; text.text = currentSentence; } if (currentPosition >= sentences.Peek().Length) { AkSoundEngine.StopPlayingID(currentSound); if (sentences.Count == 1 && choices.Length > 0) { if (!buttonExists) { CreateButtons(); buttonExists = true; } } } } else if (counter > textDuration && autoPass) { PassDialogue(); } } else if (sentences.Count == 0 && active && autoPass) { PassDialogue(); } }