Search Results for

    Show / Hide Table of Contents

    Class AbilityManager

    Manages running, querying, stopping and interaction with abilities. Takes in an AbilityData as input that defines the set of abilities this actor have access to.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    ReferenceProvider
    AbilityManager
    Inherited Members
    ReferenceProvider.OnValidate()
    ReferenceProvider.OnDestroy()
    ReferenceProvider.Bind(ReferenceRequester)
    ReferenceProvider.UnBind()
    ReferenceProvider.IsRequirementSatisfied(Type)
    ReferenceProvider.GetComponentReference<T>(Type, int)
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.destroyCancellationToken
    MonoBehaviour.useGUILayout
    MonoBehaviour.didStart
    MonoBehaviour.didAwake
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, bool)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>(bool)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(string)
    Component.CompareTag(TagHandle)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: LobsterFramework.AbilitySystem
    Assembly: LobsterFramework.dll
    Syntax
    [AddComponentMenu("AbilityManager")]
    public class AbilityManager : ReferenceProvider
    Remarks

    All inqueries and ability manipulations should be done before the LateUpdate event. Doing it during the LateUpdate event could result in race conditions and other undefined behaviors. At runtime, the input AbilityData is duplicated so any modifications done to the original asset will not be reflected. However, the data used at runtime can be edited via the custom inspector of this component and saved as asset. When a new asset derived from the runtime data is saved to the disk, the input data reference will be redirected to that instead. The custom inspector does not allow adding or removing ability configurations to avoid breaking the running abilities.

    Fields

    | Improve this Doc View Source

    ActionBlocked

    If this evaluates to true, all abilities are halted and no abilities can be enqueued.

    Declaration
    public readonly OrValue ActionBlocked
    Field Value
    Type Description
    OrValue

    Properties

    | Improve this Doc View Source

    IsAnimating

    True if a animation of an ability is currently being played, false otherwise

    Declaration
    public bool IsAnimating { get; }
    Property Value
    Type Description
    bool

    Methods

    | Improve this Doc View Source

    AnimationEnd(AnimationEvent)

    Used by animation events to signal the end of the ability. The ability will immediately terminate after this call. Do nothing if the event does not belong to the current ability animation.

    Declaration
    public void AnimationEnd(AnimationEvent animationEvent)
    Parameters
    Type Name Description
    AnimationEvent animationEvent

    The animation event instance to be queried

    | Improve this Doc View Source

    AnimationSignal(AnimationEvent)

    Used by animation events to send signals

    Declaration
    public void AnimationSignal(AnimationEvent animationEvent)
    Parameters
    Type Name Description
    AnimationEvent animationEvent
    | Improve this Doc View Source

    EnqueueAbilitiesInJoint<T, V>(string, string)

    Enqueue two abilities of different types together with the second one being guaranteed to terminate no later than the first one.

    Declaration
    public bool EnqueueAbilitiesInJoint<T, V>(string instance1 = "default", string instance2 = "default") where T : Ability where V : Ability
    Parameters
    Type Name Description
    string instance1

    Name of the instance for the first ability

    string instance2

    Name of the instance for the second ability

    Returns
    Type Description
    bool
    Type Parameters
    Name Description
    T

    The type of the first ability

    V

    The type of the second ability

    | Improve this Doc View Source

    EnqueueAbility(Type, string)

    Add an ability instance to the executing queue, return the status of this operation.
    For this operation to be successful, the following must be satisfied:

    1. The entity must not be action blocked.
    2. The specified ability instance must be present
    3. The precondition of the specified ability instance must be satisfied.
    4. The ability instance must not be currently running or enqueued.

      Note that this method should only be called before LateUpdate(), otherwise the ability instance execution will be deferred to the next frame. OnAbilityEnqueue() will be immediately called if enqueued successfully.
    Declaration
    public bool EnqueueAbility(Type abilityType, string instance = "default")
    Parameters
    Type Name Description
    Type abilityType

    Type of the ability to be enqueued

    string instance

    Name of the instance to be enqueued

    Returns
    Type Description
    bool

    true if successfully enqueued the ability instance, false otherwise

    | Improve this Doc View Source

    EnqueueAbility<T>(string)

    Add an ability instance to the executing queue, return the status of this operation.
    For this operation to be successful, the following must be satisfied:

    1. The entity must not be action blocked.
    2. The specified ability instance must be present
    3. The precondition of the specified ability instance must be satisfied.
    4. The ability instance must not be currently running or enqueued.

      Note that this method should only be called before LateUpdate(), otherwise the ability instance execution will be deferred to the next frame. OnAbilityEnqueue() will be immediately called if enqueued successfully.
    Declaration
    public bool EnqueueAbility<T>(string instance = "default") where T : Ability
    Parameters
    Type Name Description
    string instance

    Name of the instance to be enqueued

    Returns
    Type Description
    bool

    true if successfully enqueued the ability instance, false otherwise

    Type Parameters
    Name Description
    T

    Type of the Ability to be enqueued

    | Improve this Doc View Source

    GetAbilityChannel<T>(string)

    Get the ability channel of specified ability and configuration

    Declaration
    public AbilityChannel GetAbilityChannel<T>(string instance = "default") where T : Ability
    Parameters
    Type Name Description
    string instance

    The name of the ability instance

    Returns
    Type Description
    AbilityChannel

    The channel that connects to the specified ability and configuration if it exists, otherwise return null.

    Type Parameters
    Name Description
    T

    The type of Ability this channel is associated with.

    | Improve this Doc View Source

    GetAbilityComponent<T>()

    Get the specified ability component if it is present.

    Declaration
    public T GetAbilityComponent<T>() where T : AbilityComponent
    Returns
    Type Description
    T

    Return the ability component if it is present, otherwise null

    Type Parameters
    Name Description
    T

    Type of the AbilityComponent being requested

    | Improve this Doc View Source

    InterruptAbilityAnimation()

    Interrupt the currently playing ability animation, do nothing if no abilities is currently playing animation.

    Declaration
    public void InterruptAbilityAnimation()
    | Improve this Doc View Source

    IsAbilityReady(Type, string)

    Check if the specified ability instance is ready

    Declaration
    public bool IsAbilityReady(Type abilityType, string instance = "default")
    Parameters
    Type Name Description
    Type abilityType

    Type of the Ability to be queried

    string instance

    Name of the ability instance to be queried

    Returns
    Type Description
    bool

    true if the ability instance exists and is ready, false otherwise

    | Improve this Doc View Source

    IsAbilityReady<T>(string)

    Check if the specified ability instance is ready

    Declaration
    public bool IsAbilityReady<T>(string instance = "default") where T : Ability
    Parameters
    Type Name Description
    string instance

    Name of the ability instance to be queried

    Returns
    Type Description
    bool

    true if the ability instance exists and is ready, false otherwise

    Type Parameters
    Name Description
    T

    Type of the Ability to be queried

    | Improve this Doc View Source

    IsAbilityRunning(Type, string)

    Check if the specified ability instance is running

    Declaration
    public bool IsAbilityRunning(Type abilityType, string instance = "default")
    Parameters
    Type Name Description
    Type abilityType

    The type of the ability being queried

    string instance

    The name of the ability instance being queried

    Returns
    Type Description
    bool

    true if the ability instance exists and is running, otherwise false

    | Improve this Doc View Source

    IsAbilityRunning<T>(string)

    Check if the ability with specified config is running

    Declaration
    public bool IsAbilityRunning<T>(string instance = "default") where T : Ability
    Parameters
    Type Name Description
    string instance

    The name of the ability instance being queried

    Returns
    Type Description
    bool

    true if the ability instance exists and is running, otherwise false

    Type Parameters
    Name Description
    T

    The type of the ability being queried

    | Improve this Doc View Source

    JoinAbilities(Type, Type, string, string)

    Join two running abilities such that the second ability terminates no later than the primary ability.

    Declaration
    public bool JoinAbilities(Type primaryAbility, Type secondaryAbility, string instance1 = "default", string instance2 = "default")
    Parameters
    Type Name Description
    Type primaryAbility

    The type of the primary ability

    Type secondaryAbility

    The type of the secondary ability

    string instance1

    The name of the primary ability instance

    string instance2

    The name of the secondary ability instance

    Returns
    Type Description
    bool

    true on success, false otherwise

    | Improve this Doc View Source

    JoinAbilities<T, V>(string, string)

    Join two running abilities such that the second ability terminates no later than the primary ability.

    Declaration
    public bool JoinAbilities<T, V>(string instance1 = "default", string instance2 = "default") where T : Ability where V : Ability
    Parameters
    Type Name Description
    string instance1

    The name of the primary ability instance

    string instance2

    The name of the secondary ability instance

    Returns
    Type Description
    bool

    true on success, false otherwise

    Type Parameters
    Name Description
    T

    The type of the primary ability

    V

    The type of the secondary ability

    | Improve this Doc View Source

    Reset()

    Reset the status of all abilities and their configs to their initial state

    Declaration
    public void Reset()
    | Improve this Doc View Source

    Signal<T>(string)

    Send a signal to the specified ability.

    Declaration
    public void Signal<T>(string instance = "default") where T : Ability
    Parameters
    Type Name Description
    string instance
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    SuspendAbilities()

    Stops execution of all abilities

    Declaration
    public void SuspendAbilities()
    | Improve this Doc View Source

    SuspendAbilityInstance(Type, string)

    Stops the execution of the ability and returns the status of this operation

    Declaration
    public bool SuspendAbilityInstance(Type abilityType, string instance = "default")
    Parameters
    Type Name Description
    Type abilityType

    Type of the ability to be stopped

    string instance

    Name of the ability instance to be stopped

    Returns
    Type Description
    bool

    true if the ability instance exists and is stopped, otherwise return false

    | Improve this Doc View Source

    SuspendAbilityInstance<T>(string)

    Stops the execution of the ability and returns the status of this operation

    Declaration
    public bool SuspendAbilityInstance<T>(string instance = "default") where T : Ability
    Parameters
    Type Name Description
    string instance

    Name of the ability instance to be stopped

    Returns
    Type Description
    bool

    true if the ability instance exists and is stopped, otherwise return false

    Type Parameters
    Name Description
    T

    Type of the ability to be stopped

    | Improve this Doc View Source

    SuspendAbility<T>()

    Stop the execution of all instances of the specified ability

    Declaration
    public bool SuspendAbility<T>() where T : Ability
    Returns
    Type Description
    bool

    true if the ability exists, otherwise false

    Type Parameters
    Name Description
    T

    The type of the ability to be stopped

    Events

    | Improve this Doc View Source

    OnAbilityEnqueued

    Invoked when an ability is enqueued, the type of the ability is passed in as parameter.

    Declaration
    public event Action<Type> OnAbilityEnqueued
    Event Type
    Type Description
    Action<Type>
    | Improve this Doc View Source

    OnAbilityFinished

    Invoked when an ability is terminated, the type of the ability is passed in as parameter.

    Declaration
    public event Action<Type> OnAbilityFinished
    Event Type
    Type Description
    Action<Type>
    | Improve this Doc View Source

    OnAnimationBegin

    Invoked when an animation of an ability is initiated.

    Declaration
    public event Action<Type> OnAnimationBegin
    Event Type
    Type Description
    Action<Type>
    | Improve this Doc View Source

    OnAnimationEnd

    Invoked when an animation of an ability is terminated.

    Declaration
    public event Action<Type> OnAnimationEnd
    Event Type
    Type Description
    Action<Type>
    • Improve this Doc
    • View Source
    In This Article
    Back to top LobsterFramework documentation