Losing so much time from work and exercising...
Anyway, today I wanted to pat down the "ability" aspect of RTS units. Each unit is capable of certain actions, like moving and attacking called "abilities."
The HUD UI needs to be updated to reflect the ability of currently selected units. If selected units are capable of attacking, attack button needs to be visible.
Since this is a proof of a concept RTS game, there are only two abilities available, moving and attacking, already implemented, so don't have to worry about that. The following is a simple CRC diagram regarding how to initiate an ability.
*Commander: CommanderController, AKA player controller.
*SelectionPanel: HUD for selected units.
Unit
Do ability when called to do it. (UnitController, Commander)
Have abilities and their UI buttons. (AbilityButton)
AbilityButton
Draw button corresponding to an ability. (SelectionPanel)
Initiate an ability. (Unit)
Simply put, Unit have the button UI, and the required event handler.
Now, I was planning to subclass UButton(UI button class in UE4), but the subclassed C++ UButton class doesn't seem to be able to be used as a superclass for a blueprint class. This is a big problem as modders and designers should use blueprinted subclass of AbilityButton to rapidly create new ability buttons.
But a C++ subclass of UUserWidget works fine, and you can add UserWidget to another widget just like WinRT UIElement.
Anyway, today I wanted to pat down the "ability" aspect of RTS units. Each unit is capable of certain actions, like moving and attacking called "abilities."
The HUD UI needs to be updated to reflect the ability of currently selected units. If selected units are capable of attacking, attack button needs to be visible.
Since this is a proof of a concept RTS game, there are only two abilities available, moving and attacking, already implemented, so don't have to worry about that. The following is a simple CRC diagram regarding how to initiate an ability.
*Commander: CommanderController, AKA player controller.
*SelectionPanel: HUD for selected units.
Unit
Do ability when called to do it. (UnitController, Commander)
Have abilities and their UI buttons. (AbilityButton)
AbilityButton
Draw button corresponding to an ability. (SelectionPanel)
Initiate an ability. (Unit)
Simply put, Unit have the button UI, and the required event handler.
Now, I was planning to subclass UButton(UI button class in UE4), but the subclassed C++ UButton class doesn't seem to be able to be used as a superclass for a blueprint class. This is a big problem as modders and designers should use blueprinted subclass of AbilityButton to rapidly create new ability buttons.
But a C++ subclass of UUserWidget works fine, and you can add UserWidget to another widget just like WinRT UIElement.