Eye of the Nile Docs
Everything you need to know to get started!
Loading...
Searching...
No Matches
AbilityOwner Class Reference

Detailed Description

Handles timed events related to abilities. Specifically, charge ups, activating the ability, repeated events during duration time (such as healing over time), and cooldowns. It also holds useful data, namely the OwnerTransform (player’s transform), the ability info this ability is using, and the current ability state (ready to use vs on cooldown).

Documentation updated 8/21/2024

Author
Roy Pascual
Note
This script does not inherit from monobehavior, so it does not have many of the default unity functions like Start() and Update().
This class does not inhert from monobehavior, so it does not have access to unity functions such as Start() or Update().

Public Types

enum  OwnerState { ReadyToUse , Activation , OnCooldown }
 

Public Member Functions

delegate void ChargeUpEvent (AbilityOwner abilityOwner)
 delegate used to create the ChargeUp event.
 
delegate void CooldownEvent (AbilityOwner abilityOwner)
 delegate used to create the CoolDown event.
 
delegate void UpdateEvent (AbilityOwner abilityOwner)
 delegate used to create the AbilityUpdate event.
 
 AbilityOwner (Transform ownerTransform, UnityEvent onActivateAbility, BaseAbilityInfo newAbilityInfo)
 When a new abilityOwner object is created in another class, this function automatically runs. It assigns the three variables to the given parameters, which must be given in order to create this object.
 
IEnumerator ChargingUp ()
 Waits [abilityInfo.chargeUp] seconds, before triggering the ability, prepares for cooldown, and then triggers AbilityUpdate and CoolDown.
 
IEnumerator CoolingDown ()
 Waits [abilityInfo.cooldown] seconds before resetting currentState to ReadyToUse.
 
IEnumerator UpdateWithinDuration ()
 Runs abilityInfo.AbilityUpdate() repeatedly (waiting abilityInfo.tickRate second each time) until the ability ends. Then running abilityInfo.AbilityDisable() for each effect type.
 
void ActivateAbility ()
 If the ability is ready to use, start the charge up.
 
void EnablePassive ()
 
void DisablePassive ()
 

Public Attributes

UnityEvent OnActivateAbility
 A generic event that is called when an ability is activated. Assigned in the Unity Editor under PlayerAbilityController.cs.
 
BaseAbilityInfo abilityInfo
 The ability info that this ability uses.
 
OwnerState currentState = OwnerState.ReadyToUse
 Whether this ability is ready to use, activating, or on cooldown.
 
float cooldownEnd = 0f
 Time when ability cooldown ends.
 

Properties

Transform OwnerTransform [get, set]
 Transform of the ability owner (usually the player's transform).
 

Events

ChargeUpEvent ChargeUp
 When triggered, a function subscribed to it in PlayerAbilityController.cs will run ChargingUp().
 
CooldownEvent CoolDown
 When triggered, a function subscribed to it in PlayerAbilityController.cs will run CoolingDown().
 
UpdateEvent AbilityUpdate
 When triggered, a function subscribed to it in PlayerAbilityController.cs will run UpdateWithinDuration().
 

Private Attributes

float updateEnd = 0f
 Time until ability duration is up.
 

Member Enumeration Documentation

◆ OwnerState

Enumerator
ReadyToUse 
Activation 
OnCooldown 

Constructor & Destructor Documentation

◆ AbilityOwner()

AbilityOwner.AbilityOwner ( Transform ownerTransform,
UnityEvent onActivateAbility,
BaseAbilityInfo newAbilityInfo )

When a new abilityOwner object is created in another class, this function automatically runs. It assigns the three variables to the given parameters, which must be given in order to create this object.

Parameters
ownerTransformThe transform of the player.
onActivateAbilityA generic event that is called when an ability is activated.
newAbilityInfoThe ability info that this ability uses.

Member Function Documentation

◆ ActivateAbility()

void AbilityOwner.ActivateAbility ( )

If the ability is ready to use, start the charge up.

◆ ChargeUpEvent()

delegate void AbilityOwner.ChargeUpEvent ( AbilityOwner abilityOwner)

delegate used to create the ChargeUp event.

◆ ChargingUp()

IEnumerator AbilityOwner.ChargingUp ( )

Waits [abilityInfo.chargeUp] seconds, before triggering the ability, prepares for cooldown, and then triggers AbilityUpdate and CoolDown.

◆ CooldownEvent()

delegate void AbilityOwner.CooldownEvent ( AbilityOwner abilityOwner)

delegate used to create the CoolDown event.

◆ CoolingDown()

IEnumerator AbilityOwner.CoolingDown ( )

Waits [abilityInfo.cooldown] seconds before resetting currentState to ReadyToUse.

◆ DisablePassive()

void AbilityOwner.DisablePassive ( )

◆ EnablePassive()

void AbilityOwner.EnablePassive ( )

◆ UpdateEvent()

delegate void AbilityOwner.UpdateEvent ( AbilityOwner abilityOwner)

delegate used to create the AbilityUpdate event.

◆ UpdateWithinDuration()

IEnumerator AbilityOwner.UpdateWithinDuration ( )

Runs abilityInfo.AbilityUpdate() repeatedly (waiting abilityInfo.tickRate second each time) until the ability ends. Then running abilityInfo.AbilityDisable() for each effect type.

Member Data Documentation

◆ abilityInfo

BaseAbilityInfo AbilityOwner.abilityInfo

The ability info that this ability uses.

◆ cooldownEnd

float AbilityOwner.cooldownEnd = 0f

Time when ability cooldown ends.

◆ currentState

OwnerState AbilityOwner.currentState = OwnerState.ReadyToUse

Whether this ability is ready to use, activating, or on cooldown.

◆ OnActivateAbility

UnityEvent AbilityOwner.OnActivateAbility

A generic event that is called when an ability is activated. Assigned in the Unity Editor under PlayerAbilityController.cs.

◆ updateEnd

float AbilityOwner.updateEnd = 0f
private

Time until ability duration is up.

Property Documentation

◆ OwnerTransform

Transform AbilityOwner.OwnerTransform
getset

Transform of the ability owner (usually the player's transform).

Event Documentation

◆ AbilityUpdate

UpdateEvent AbilityOwner.AbilityUpdate

When triggered, a function subscribed to it in PlayerAbilityController.cs will run UpdateWithinDuration().

Note
For a detailed description of how this event is used, visit /ref abilityOwnerEvents

◆ ChargeUp

ChargeUpEvent AbilityOwner.ChargeUp

When triggered, a function subscribed to it in PlayerAbilityController.cs will run ChargingUp().

Note
For a detailed description of how this event is used, visit /ref abilityOwnerEvents

◆ CoolDown

CooldownEvent AbilityOwner.CoolDown

When triggered, a function subscribed to it in PlayerAbilityController.cs will run CoolingDown().

Note
For a detailed description of how this event is used, visit /ref abilityOwnerEvents

The documentation for this class was generated from the following file: