document.write("
// Fill out your copyright notice in the Description page of Project Settings. class UInputAction; DECLARE_LOG_CATEGORY_EXTERN(LogGameplayAbility, Log, All); /** * Base Dandelion GA class. */ UCLASS() class DANDELION_API UDandelionGameplayAbility : public UGameplayAbility { GENERATED_BODY() public: /** * Native-only convenience helper function that also attempts to cast the AvatarActor to a desired class. * @tparam T The class to attempt to cast the AvatarActor to. * @return A reference to the cast AvatarActor if it is valid to do so. nullptr otherwise. */ template <class T> T* TryCastAvatarActorFromActorInfo() const { return Cast<T>(GetAvatarActorFromActorInfo()); } /** * Ends or cancels a GA that is currently running and then starts the ability again. * @param Handle Spec describing the GA that will be restarted on the ASC. * @param ActorInfo Info describing the actor that restarted the ability. * @param ActivationInfo Data related to the networking configuration when this ability was restarted. * @param bReplicateRestartAbility Whether the end/cancel and restart behaviors should be replicated to clients. * @param bCancelAbility If true, calls CancelAbility on the ability before restarting it. If false, just calls * EndAbility. * @param bAllowRemoteActivation If true, remotely activate local/server abilities, if false only try to locally * activate the ability when restarting. */ virtual void RestartAbility( const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, const bool bReplicateRestartAbility, bool bCancelAbility, bool bAllowRemoteActivation ); /** * Latent version of RestartAbility. Ends or cancels a GA that is currently running and then starts the ability * again. * @param bReplicateRestartAbility Whether the end/cancel and restart behaviors should be replicated to clients. * @param bCancelAbility If true, calls CancelAbility on the ability before restarting it. If false, just calls * EndAbility. * @param bAllowRemoteActivation If true, remotely activate local/server abilities, if false only try to locally * activate the ability when restarting. */ UFUNCTION( BlueprintCallable, Category = Ability, DisplayName = "RestartAbility", meta=(ScriptName = "RestartAbility") ) virtual void K2_RestartAbility( const bool bReplicateRestartAbility, const bool bCancelAbility, const bool bAllowRemoteActivation ); /** * Checks whether this ability can restart or not. Inheriting classes can implement more specific checking if * needed. * TODO: Make a BP version of this method if needed. * @param Handle Handle of the GameplayAbilitySpec that will be checked. * @param ActorInfo Actor Info for the ability that will be checked. * @param ActivationInfo Networking data related to the activation of the ability that will be checked.. * @return True if this ability can be restarted. False otherwise. */ virtual bool CanRestartAbility( const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo& ActivationInfo ); /** * Base override to provide logging when an ability is granted to an ASC. * @param ActorInfo Info describing the actor that was given the ability. * @param Spec Spec describing the GA that was given to the ASC. */ virtual void OnGiveAbility(const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilitySpec& Spec) override; /** * Base override to provide logging when an ability is activated on an ASC. * @param Handle Spec describing the GA that was activated on the ASC. * @param ActorInfo Info describing the actor that activated the ability. * @param ActivationInfo Data related to the networking configuration when this ability was activated. * @param TriggerEventData Any data that accompanied the activation of this GA via GameplayEvents. */ virtual void ActivateAbility( const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, const FGameplayEventData* TriggerEventData ) override; /** * Base override to provide logging when an ability is committed on an ASC. * @param Handle Spec describing the GA that was activated on the ASC. * @param ActorInfo Info describing the actor that activated the ability. * @param ActivationInfo Data related to the networking configuration when this ability was activated. * @param OptionalRelevantTags An out parameter for tags that may be relevant to committing this ability. * @return True if costs and tag requirements are met, false otherwise. */ virtual bool CommitAbility( const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, OUT FGameplayTagContainer* OptionalRelevantTags = nullptr ) override; /** * Base override to provide logging when an ability ends on an ASC. * @param Handle Spec describing the GA that ended on the ASC. * @param ActorInfo Info describing the actor that ended the ability. * @param ActivationInfo Data related to the networking configuration when this ability was activated. * @param bReplicateEndAbility Whether the ending of this ability should be replicated across the network. * @param bWasCancelled Whether the ability was ended or canceled. */ virtual void EndAbility( const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateEndAbility, bool bWasCancelled ) override; /** * Base override to provide logging when an ability gets canceled on an ASC. * @param Handle Spec describing the GA that was canceled on the ASC. * @param ActorInfo Info describing the actor that canceled the ability. * @param ActivationInfo Data related to the networking configuration when this ability was activated. * @param bReplicateCancelAbility Whether the cancellation of this ability should be replicated across the network. */ virtual void CancelAbility( const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateCancelAbility ) override; private: /** * Attempts to retrieve the ASC owner actor. Returns nullptr if this fails at anypoint. * TODO: Maybe introduce more specific logging to make it easier to backtrace the invalid reference. * @param ActorInfo The FGameplayAbilityActorInfo to be searched. * @return The ASC OwnerActor or nullptr on failure. */ static AActor* GetASCOwnerActor(const FGameplayAbilityActorInfo* ActorInfo); };