Notable states¶
SetText contains some key fields and local variables that are important to understand. They especially have to do with Dialogue mode.
message¶
A global flag on MainManager behaving like a lock that enforces the restriction that only one Dialogue mode call can execute at a given time. It is used to prevent behaviors to take place until its value is set to false. In Dialogue mode, this lock is set to true on Dialogue setup and released on Dialogue Cleanup.
White it is possible to bypass it this restriction by ignoring the value of message, doing so has undefined behaviors.
waitinput¶
A global flag on MainManager that acts as a lock to wait for a confirmation input (confirm or cancel). This is used with the Text advance system in Dialogue mode by yielding during Dialogue post-processing.
tailtarget¶
The entity pointed by the textbox. This is meant to show who is talking. This can be overridden by tail.
This is automatically managed by MainManager.LateUpdate such that as long as a texttail exists (which only happens during dialogue mode setup), the tailtarget is updated in the following manner on each LateUpdate after a completed boot:
- If
tailtargetisn't set, it is disabled - Otherwise, the following happens to
texttail:- It gets enabled
- Its position is set to the
tailtarget's position - Its local x position is clamped from -3.0 to 3.0
- Its local y position is set to a value based on
texttailz angle. If that angle is 180.0 or lower, the local y position of thetexttailis set to -1.0 - thetexttailz angle / 60.0 clamped from -1.7 to -1.1. Otherwise (angle is higher than 180.0), it's set to -1.0 - (the absolute value oftexttailz angle - 360.0) / 60.0 clamped from -1.7 to -1.1 - Its local z position is set to 0.0
- Its z angle is set to a a value calculated with the following steps:
- Take a Vector2 where the x component
MainCamera.WorldToViewportPoint oftailtargetposition.x -MainCamera.WorldToViewportPoint oftexttailposition.x and the y component istailtargety position -texttaily position - Take the vector.x / vector.y * (0.0 -
MainCamera.WorldToViewportPoint oftaitargetposition.z * 100.0) - Clamp the above from -50.0 to 50.0
- Take a Vector2 where the x component
textbox¶
The box that holds the text in Dialogue mode. This contains the textholder. It can be hidden with a shrink animation or revealed with a grow animation.
textholder¶
The GameObject that holds all the TextMesh SetText renders. Its parent is set to the parent parameter with a local position of the position parameter. Its localEulerAngles is set to zero if the tridimensional parameter is false and its scales is set to Vector3.one. Its name will be Text: followed by the input string and its tag will be set to Text.
fonttype¶
This is a parameter sent to SetText that determines the font to render.
Font id table¶
| Name | ID |
|---|---|
BubblegumSans |
0 |
D3Streetism |
1 |
UNUSED (gets overriden to D3Streetism by MainManager.FontID) |
2 |
Uzura |
3 |
BalsamiqSans |
4 |
ONEMobilePOP |
5 |