Abilities
Here we have a solution to represent character Abilities. They can be related to movement, attacks or other stuff.
Basic Abilities
These would be abilities considered to be the most basic and therefore you will need nothing but the abilitiy’s component itself to make it work. Just add into your character, tweak as you want and it will be ready to go.
The ability to flip or to perform basic movements are examples of basic abilities.
Learnable abilities
Through out a game Some abilities can be learned, unlearned, activated and deactivated depending on your game’s logic.
So, for the sake of organizing and allowing us to have multiple setups for abilities configurations, we use ScriptableObjects as setup for this kind of abilities. This way you can create multiple setups and use them in different situations along your game.
So, when configuring some learnable ability component, associate the correct setup with it this will grant the component to work properly.
Learnable Ability Setup
Every learnable ability setup have 2 main boolean properties wich will allow you to operate them as you wish. They are:
|
This means your character has already learned that ability therefore can use it if it is active |
|
This means the ability is active and can be used. This consider if ability is learned or not |
We also have one UnityEvent<bool>
for each of the above properties value changes updates:
|
Invoked every time the |
|
Invoked every time the |
And these available methods:
|
If Ability is learned, activates it and invokes |
|
Deactivates the ability and invokes active status update event. |
|
Sets ability learned status as true and invokes learned status update event. |
|
Sets ability learned status as false and invokes learned status update event. |
|
Learn and activate the ability. Perfect for when managing abilities |
These properties and events can be really handy for the case of building an ability manager. Say you want to handle when a
specifc ability is considered learned (maybe buy purchasing it on store or picking up a collectable item). Just access the
ability setup ScriptableObject
through your script and call its Learn()
or LearnAndActivate()
methods.
Also, considering you may want to disable some ability temporally based on your game’s logic, but still want to display that particular ability
as learned, use the Activate()
and Deactivate()
methods to handle this.
Have in mind that an ability crafted by us will only perform in case both learned
and active
are set as true. All abilities
listed below will have their setups properly documented.
Note
Abilities setups are crafted to represent an specific character setup of abilities. So, if you have different characters with the same ability,
this means you would probably want to create different ScriptableObject
setups for each of them.