IEnumerator <WaitForSeconds> _DisplayPiece(StoryPiece piece) { if (currentlyShowing != null) { yield return(new WaitForSeconds(0.5f)); } if (piece.audio) { speaker.PlayOneShot(piece.audio, piece.audioVolume); } currentlyShowing = piece; characterName.text = piece.characterName; body.text = piece.body; profilePicture.sprite = piece.profilePicture; profilePicture.enabled = true; if (anim) { anim.SetTrigger("Flash"); } if (piece.clearMode == StoryClearMode.Time) { yield return(new WaitForSeconds(piece.clearTime)); if (currentlyShowing == piece) { _ClearDisplay(); } } }
void _ClearDisplay() { mostRecentKey = ""; currentlyShowing = null; if (anim) { anim.SetTrigger("NoContent"); } }
void DisplayPiece(StoryPiece piece) { if (currentlyShowing != null && piece.priority == StoryPriority.Optional) { return; } StartCoroutine(_DisplayPiece(piece)); }
void _ShowPieceByKey(string key) { for (int i = 0; i < pieces.Length; i++) { StoryPiece piece = pieces[i]; if (piece.key == key) { DisplayPiece(piece); return; } } Debug.LogError(string.Format("Could not find story piece '{0}'", key)); }