# Abilities System Structure

<figure><img src="https://1095504291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiNhXrPwcj8TJ32pNkD2R%2Fuploads%2FnRjkToSDPHWjYLUd96oS%2Fchart.png?alt=media&#x26;token=6bed2955-66d2-4458-8d7f-2a8b3083f1bc" alt=""><figcaption><p>Simplified diagram of Abilities System</p></figcaption></figure>

Each ability is described by a two classes - Ability Data and Ability Behavior.

#### Ability Data

<figure><img src="https://1095504291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiNhXrPwcj8TJ32pNkD2R%2Fuploads%2FMsm6zFLcB0QCoVcD5gXA%2Fimage.png?alt=media&#x26;token=1171b91a-309c-4e5e-8bcf-eec7548e20f3" alt="" width="471"><figcaption><p>Ability Data example</p></figcaption></figure>

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.&#x20;

<figure><img src="https://1095504291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiNhXrPwcj8TJ32pNkD2R%2Fuploads%2FAWpx04Xdqrq1p4yMzoO6%2Fimage.png?alt=media&#x26;token=14eb3621-7ebf-47ce-9bc4-bcdf46f36ad5" alt="" width="479"><figcaption><p>Evolution Requirement List example</p></figcaption></figure>

All Ability Data scriptable objects are stored in the AbilitiesDatabase scriptable object.

#### Ability Behavior

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.

<figure><img src="https://1095504291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiNhXrPwcj8TJ32pNkD2R%2Fuploads%2FNF6jzPEgV7uxSo40OVn7%2Fimage.png?alt=media&#x26;token=8623e5e8-076c-43c6-9238-ef5e9f67c992" alt="" width="563"><figcaption><p>Fireball Ability Prefab</p></figcaption></figure>

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.&#x20;
