/// <summary> /// Plays the next cutscene element. /// /// </summary> public void playNext() { // increment the cutscene counter cutscenePosition++; currentChar = 0; if (cutscenePosition <= cutsceneElements.Count) { CutsceneElement currentCutsceneElement = cutsceneElements[cutscenePosition - 1]; if (currentCutsceneElement.hasDialog) { setDialogVisibility(true); dialogSpeakerText.text = currentCutsceneElement.speakerName; } else { setDialogVisibility(false); } } else { setDialogVisibility(false); } //notify registered listeners of the new position if (OnCutsceneChange != null) { OnCutsceneChange(cutscenePosition); } }
/// <summary> /// Parses a scene element from a given string, and returns the result /// </summary> /// <returns>The scene element.</returns> /// <param name="line">The line to parse</param> private CutsceneElement readSceneElement(string line) { CutsceneElement newElement = new CutsceneElement(); // if the line is not denoted as blank, OR commented out if (line != "***") { string[] splitLine = line.Split(new char[] { ':' }, 2); // should the player be allowed to advance manually? if (splitLine[0][0] == '*') { newElement.allowPlayerAdvance = false; newElement.speakerName = splitLine [0].Substring(1).Trim(); } else { newElement.speakerName = splitLine [0].Trim(); } newElement.hasDialog = true; newElement.dialogText = splitLine [1].Trim(); } return(newElement); }
/// <summary> /// Parses a scene element from a given string, and returns the result /// </summary> /// <returns>The scene element.</returns> /// <param name="line">The line to parse</param> private CutsceneElement readSceneElement(string line) { CutsceneElement newElement = new CutsceneElement(); // if the line is not denoted as blank, OR commented out if (line != "***") { string[] splitLine = line.Split (new char[] {':'}, 2); // should the player be allowed to advance manually? if(splitLine[0][0] == '*') { newElement.allowPlayerAdvance = false; newElement.speakerName = splitLine [0].Substring(1).Trim (); } else { newElement.speakerName = splitLine [0].Trim (); } newElement.hasDialog = true; newElement.dialogText = splitLine [1].Trim (); } return newElement; }