using UnityEngine; using System.Collections; namespace Fungus { /// /// Writes text using a typewriter effect to a UI text object. /// public interface IWriter { /// /// This property is true when the writer is writing text or waiting (i.e. still processing tokens). /// bool IsWriting { get; } /// /// This property is true when the writer is waiting for user input to continue. /// bool IsWaitingForInput { get; } /// /// Stop writing text. /// void Stop(); /// /// Writes text using a typewriter effect to a UI text object. /// /// Text to be written /// If true clears the previous text. /// Writes the text and then waits for player input before calling onComplete. /// Stops any currently playing audioclip. /// Audio clip to play when text starts writing. /// Callback to call when writing is finished. IEnumerator Write(string content, bool clear, bool waitForInput, bool stopAudio, AudioClip audioClip, System.Action onComplete); /// /// Sets the color property of the text UI object. /// void SetTextColor(Color textColor); /// /// Sets the alpha component of the color property of the text UI object. /// void SetTextAlpha(float textAlpha); } /// /// Implement this interface to be notified about Writer events. /// public interface IWriterListener { /// /// Called when a user input event (e.g. a click) has been handled by the Writer. /// void OnInput(); /// Called when the Writer starts writing new text /// An optional audioClip sound effect can be supplied (e.g. for voiceover) void OnStart(AudioClip audioClip); /// Called when the Writer has paused writing text (e.g. on a {wi} tag). void OnPause(); /// Called when the Writer has resumed writing text. void OnResume(); /// Called when the Writer has finished writing text. /// Controls whether audio should be stopped when writing ends. void OnEnd(bool stopAudio); /// Called every time the Writer writes a new character glyph. void OnGlyph(); /// /// Called when voiceover should start. /// void OnVoiceover(AudioClip voiceOverClip); } }