Sample of Stamina(GS2 UIKit for Unity)
Implement the Stamina function.
Open the project and you will see the above.
When executed, the remaining amount of stamina and the UI for stamina operations will be displayed as shown here.
First, click the “Consume(5)” button.
Having consumed stamina, the remaining amount is displayed as “45/50” and a countdown is shown until it is recovered.
Next, click the “Recover(10)” button.
The remaining amount of stamina will be “55/50”. The countdown will not be displayed again because the maximum value has been exceeded.
Note the hierarchy of the scene.
Specifies the stamina of GS2-Stamina handled by the node under this GameObject.
In this case, we specify a stamina named Stamina in the namespace stamina-0001 of GS2-Stamina.
After loading the Stamina, activate StaminaValue.
Gets the percentage of the current stamina value relative to the maximum value, from 0.0 to 1.0. The value is rounded to 1.0 when the maximum value is exceeded.
The result obtained is passed to OnUpdate(Single) and reflected in the Slider value.
Enables a GameObject based on whether the maximum value of stamina has been reached.
Gets the date and time when stamina will be restored next time. The result is called back to OnUpdate(int64) and the value is reflected in Gs2CoreTimeSpanLabel.
Formats the remaining time until the next recovery of stamina into the format specified by Format. The formatted text is called back to OnUpdate(String), from which the value is reflected in the Text component.
A prefab is set up to perform the login process.
sample of Account, please refer to the explanation there.