Class AbilitySystemComponent
The IGameplayAbilitySystem is the primary component of the Gameplay Ability System. Every component that needs to participate with the Ability System (such as receiving or dealing damage) needs to have this component.
Inheritance
Implements
Namespace: GameplayAbilitySystem
Assembly: Assembly-CSharp-firstpass.dll
Syntax
public class AbilitySystemComponent : MonoBehaviour, IGameplayAbilitySystem
Fields
| Improve this Doc View Source_activeGameplayEffects
Declaration
protected List<ActiveGameplayEffectData> _activeGameplayEffects
Field Value
| Type | Description |
|---|---|
| List<ActiveGameplayEffectData> |
_runningAbilities
Declaration
protected List<IGameplayAbility> _runningAbilities
Field Value
| Type | Description |
|---|---|
| List<IGameplayAbility> |
Properties
| Improve this Doc View SourceActiveGameplayEffects
Lists all active GameplayEffect on this IGameplayAbilitySystem
Declaration
public List<ActiveGameplayEffectData> ActiveGameplayEffects { get; }
Property Value
| Type | Description |
|---|---|
| List<ActiveGameplayEffectData> |
OnGameplayAbilityActivated
Called when a IGameplayAbility is activated on this IGameplayAbilitySystem. Activation may or may not result in the ability actually running.
Declaration
public GenericAbilityEvent OnGameplayAbilityActivated { get; }
Property Value
| Type | Description |
|---|---|
| GenericAbilityEvent |
OnGameplayAbilityCommitted
Called when a IGameplayAbility is committed on this IGameplayAbilitySystem. This indicates that the resource/cooldown for the ability have been commited and the ability will be executed
Declaration
public GenericAbilityEvent OnGameplayAbilityCommitted { get; }
Property Value
| Type | Description |
|---|---|
| GenericAbilityEvent |
OnGameplayAbilityEnded
Called when a IGameplayAbility ends IGameplayAbilitySystem (e.g. EndAbility(IGameplayAbilitySystem) is called) This indicates that the resource/cooldown for the ability have been commited and the ability will be executed
Declaration
public GenericAbilityEvent OnGameplayAbilityEnded { get; }
Property Value
| Type | Description |
|---|---|
| GenericAbilityEvent |
OnGameplayEvent
This event is called when a GameplayEvent is executed this IGameplayAbilitySystem
Declaration
public GameplayEvent OnGameplayEvent { get; }
Property Value
| Type | Description |
|---|---|
| GameplayEvent |
RunningAbilities
List of running abilities that have not ended on this IGameplayAbilitySystem
Declaration
public List<IGameplayAbility> RunningAbilities { get; }
Property Value
| Type | Description |
|---|---|
| List<IGameplayAbility> |
Methods
| Improve this Doc View SourceAddGameplayEffectToActiveList(GameplayEffect)
Applies a GameplayEffect to this IGameplayAbilitySystem
Declaration
public void AddGameplayEffectToActiveList(GameplayEffect Effect)
Parameters
| Type | Name | Description |
|---|---|---|
| GameplayEffect | Effect | Effect to be applied |
ApplyGameEffectToTarget(GameplayEffect, IGameplayAbilitySystem, Single)
Applies a GameplayEffect to the target IGameplayAbilitySystem. The overall effect may be modulated by the Level.
Declaration
public GameplayEffect ApplyGameEffectToTarget(GameplayEffect Effect, IGameplayAbilitySystem Target, float Level = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GameplayEffect | Effect | Effect to be applied |
| IGameplayAbilitySystem | Target | Target on which effect is to be applied |
| System.Single | Level | Level of the effect. May be used to affect the "strength" of the effect |
Returns
| Type | Description |
|---|---|
| GameplayEffect | GameplayEffect that was applied to the target |
CanActivateAbility(GameplayAbility)
Checks to see if the GameplayAbility can be activated on this component. Does not execute the ability.
Declaration
public bool CanActivateAbility(GameplayAbility Ability)
Parameters
| Type | Name | Description |
|---|---|---|
| GameplayAbility | Ability | The GameplayAbility to execute |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the ability can be activated, false otherwise |
GetActor()
Gets the parent
Declaration
public Transform GetActor()
Returns
| Type | Description |
|---|---|
| Transform |
GetNumericAttribute(AttributeType)
Gets the numerical value of an attribute attached to this
Declaration
public float GetNumericAttribute(AttributeType AttributeType)
Parameters
| Type | Name | Description |
|---|---|---|
| AttributeType | AttributeType | Type of attribute to get value of |
Returns
| Type | Description |
|---|---|
| System.Single | Current value of attribute |
HandleGameplayEvent(GameplayTag, GameplayEventData)
Responds to a Gameplay Event on this IGameplayAbilitySystem
Declaration
public void HandleGameplayEvent(GameplayTag EventTag, GameplayEventData Payload)
Parameters
| Type | Name | Description |
|---|---|---|
| GameplayTag | EventTag | Tag of the event |
| GameplayEventData | Payload | Payload containing information about the event, such as target, etc. |
NotifyAbilityEnded(GameplayAbility)
Notifies this IGameplayAbilitySystem that the specified GameplayAbility has ended
Declaration
public void NotifyAbilityEnded(GameplayAbility ability)
Parameters
| Type | Name | Description |
|---|---|---|
| GameplayAbility | ability |
TryActivateAbility(GameplayAbility)
Attempts to activate the GameplayAbility.
Declaration
public bool TryActivateAbility(GameplayAbility Ability)
Parameters
| Type | Name | Description |
|---|---|---|
| GameplayAbility | Ability | The GameplayAbility to execute |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the ability was activated, false otherwise |
UpdateCooldowns()
Declaration
protected void UpdateCooldowns()