Hello EveryOne,
I wanted to replace Busy Text in the TurnBaseCourse inspirating me from button Action creation.
So in the BaseAction Script I have had public abstract String under the GetActionName one;
public abstract string GetActionName();
//new line
public abstract string CurrentActionName();
then as for GetActionName, i have had new override string in each action you have, move rotate, etc. under the GetActionName:
Calling them alternativly running and spinning.
public override string GetActionName()
{
return "Move";
}
public override string CurrentActionName()
{
return "Running";
}
Then in the ActionBusyUI Script i’ve created a serializedField for the textmeshpro:
[SerializeField] private TextMeshProUGUI currentAction;
Don’t forget to save and drag the BusyUI TextMeshPro in the new field in unity
Then I’ve created the updateText method to replace the actual text (in the ActionBusyUI script) where I reach on the selected action:
private void UpdateActionText()
{
BaseAction SelectedAction = UnitActionSystem.Instance.GetSelectedAction();
currentAction.text = SelectedAction.CurrentActionName();
}
And to finish I add this UpdateActionText method in the UnitActionSystem_OnBusyChanged(object sender, bool isBusy) method:
private void UnitActionSystem_OnBusyChanged(object sender, bool isBusy)
{
if (isBusy)
{
Show();
UpdateActionText();
}
else
{
Hide();
}
}
That’s all
Now when I move, the running text appears in the old busy panel. The same when I spin
Hoping it Help.
Thanks a lot for your course.
Have a nice day.
François