Class TypewriterCore
Base class for all Typewriters.
- Manual: Typewriters.
Namespace: Febucci.UI.Core
Assembly: Febucci.TextAnimator.Runtime.dll
Syntax
public abstract class TypewriterCore : MonoBehaviour
Remarks
If you want to use the built-in Typewriter, see: TypewriterByCharacter or TypewriterByWord
You can also create custom typewriters by inheriting from this class.
Manual: Writing Custom Typewriters (C#)
Fields
disappearanceOrientation
Declaration
public TypewriterCore.DisappearanceOrientation disappearanceOrientation
Field Value
Type | Description |
---|---|
TypewriterCore.DisappearanceOrientation |
hideAppearancesOnSkip
Declaration
public bool hideAppearancesOnSkip
Field Value
Type | Description |
---|---|
System.Boolean |
hideDisappearancesOnSkip
Declaration
public bool hideDisappearancesOnSkip
Field Value
Type | Description |
---|---|
System.Boolean |
onCharacterVisible
Called once a character has been shown by the typewriter.
Declaration
public CharacterEvent onCharacterVisible
Field Value
Type | Description |
---|---|
CharacterEvent |
Remarks
It is only invoked when the typewriter is enabled.
onMessage
Called once an event has been shown by the typewriter.
See the Events Manual for more info.
Declaration
public MessageEvent onMessage
Field Value
Type | Description |
---|---|
MessageEvent |
Remarks
It is only invoked when the typewriter is enabled.
onTextDisappeared
Called once the typewriter has completed hiding all the letters.
Declaration
public UnityEvent onTextDisappeared
Field Value
Type | Description |
---|---|
UnityEvent |
Remarks
It is only invoked when the typewriter is enabled.
onTextShowed
Called once the text is completely shown.
If the typewriter is enabled, this event is called once it has ended showing all letters.
Declaration
public UnityEvent onTextShowed
Field Value
Type | Description |
---|---|
UnityEvent |
onTypewriterStart
Called once the typewriter starts showing text.
Declaration
public UnityEvent onTypewriterStart
Field Value
Type | Description |
---|---|
UnityEvent |
Remarks
It is only invoked when the typewriter is enabled.
resetTypingSpeedAtStartup
Declaration
public bool resetTypingSpeedAtStartup
Field Value
Type | Description |
---|---|
System.Boolean |
startTypewriterMode
Declaration
public TypewriterCore.StartTypewriterMode startTypewriterMode
Field Value
Type | Description |
---|---|
TypewriterCore.StartTypewriterMode |
useTypeWriter
true
if the typewriter is enabled
Declaration
public bool useTypeWriter
Field Value
Type | Description |
---|---|
System.Boolean |
Properties
isBaseInsideRoutine
Declaration
protected bool isBaseInsideRoutine { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
isHidingText
True if the typewriter is currently disappearing the text
Declaration
public bool isHidingText { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
isShowingText
True if the typewriter is currently showing letters
Declaration
public bool isShowingText { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
textAnimator
Declaration
public TAnimCore textAnimator { get; }
Property Value
Type | Description |
---|---|
TAnimCore |
TextAnimator
The TextAnimator Component linked to this typewriter
Declaration
public TAnimCore TextAnimator { get; }
Property Value
Type | Description |
---|---|
TAnimCore |
typewriterPlayerSpeed
Declaration
protected float typewriterPlayerSpeed { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
wantsToSkip
Declaration
protected bool wantsToSkip { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
GetWaitAppearanceTimeOf(Int32)
Declaration
protected abstract float GetWaitAppearanceTimeOf(int charIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | charIndex |
Returns
Type | Description |
---|---|
System.Single |
GetWaitDisappearanceTimeOf(Int32)
Handles characters delay when disappearing text.
Declaration
protected virtual float GetWaitDisappearanceTimeOf(int charIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | charIndex | Current character that should decide how much time to wait. Check Characters to view its info |
Returns
Type | Description |
---|---|
System.Single | time to wait before disappearing the next character |
OnDisable()
Unity's default MonoBehavior 'OnDisable' callback.
Declaration
protected virtual void OnDisable()
Remarks
P.S. If you're overriding this method, don't forget to invoke the base one.
OnEnable()
Unity's default MonoBehavior 'OnEnable' callback.
Declaration
protected virtual void OnEnable()
Remarks
P.S. If you're overriding this method, don't forget to invoke the base one.
SetTypewriterSpeed(Single)
Makes the typewriter slower/faster, by setting its internal speed multiplier.
Declaration
public void SetTypewriterSpeed(float value)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value |
Remarks
The minimum value is 0.001
Examples
If the typewriter has to wait 1
second to show the next letter but you set the typewriter speed to 2
, the typewriter will wait 0.5
seconds.
ShowText(String)
Sets the given text to the connected TextAnimator component.
If enabled, it also starts showing letters dynamically.
- Manual: Text Animator Players
Declaration
public void ShowText(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text |
Remarks
If the typewriter is enabled but its start mode startTypewriterMode doesn't include OnShowText, this method won't start showing letters. You'd have to manually call StartShowingText(Boolean) in order to start the typewriter, or include different "start modes" like OnEnable and let the script manage it automatically.
SkipTypewriter()
Skips the typewriter animation (if it's currently showing).
In case the text is revealing, it will show all the letters immediately.
In case the text is hiding, it will hide all the letters immediately.
Declaration
public void SkipTypewriter()
Remarks
If both revealing and hiding are occurring, hiding will prevail.
StartDisappearingText()
Starts disappearing the text dynamically
Declaration
public void StartDisappearingText()
StartShowingText(Boolean)
Starts showing letters dynamically
Declaration
public void StartShowingText(bool restart = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | restart | if you want the typewriter to resume where it has left. if the typewriter should restart from character 0
|
StopDisappearingText()
Stops the typewriter's from disappearing the text dynamically, leaving the text at its current state
Declaration
public void StopDisappearingText()
StopShowingText()
Stops showing letters dynamically, leaving the text as it is.
Declaration
public void StopShowingText()
TriggerRemainingEvents()
Triggers all messages/events that have not yet been triggered, even if they're not shown in the yet.
Declaration
public void TriggerRemainingEvents()
Remarks
TriggerVisibleEvents()
Triggers all messages/events that have not been triggered, but that are in the visible range of the text.
Declaration
public void TriggerVisibleEvents()