Abilities System Structure
Last updated
Last updated
Each ability is described by a two classes - Ability Data and Ability Behavior.
Ability Data - is an abstract class that contains all the necessary information about the ability (such as it's type, title, description, prefab, levels, etc.). Each ability has it's unique class that inherits from the AbilityData. Ability Data class is a Scriptable Object, which means that it contains presistent information that does not get erased between game sessions.
Each ability has levels - the upgradable part of an ability. They usually contain such information as damage, projectiles count and speed, etc.
If an ability is an evolution, it has a evolution requirement - a list of abilities with their levels.
All Ability Data scriptable objects are stored in the AbilitiesDatabase scriptable object.
Ability Behavior is a gameplay representation of an ability. It has it's own prefab and implements the behavior of the ability. For example, FireballAbilityBehavior spawns fireball projectiles according to the FireballAbilityData parameters. It initiates the pool of fireball projectiles in it's Awake method, and starts AbilityCoroutine when it gets it's ability level. This coroutine is responsible for the spawning and initializing data of the fireball projectiles.
All Ability Behaviors are managed by an Ability Manager - a singleton object that are present in the Game scene hierarchy. It is responsible for spawning, upgrading, and removing ability behaviors, selecting ability types for the Abilities Window and Chest Window.