/** * Canceling an non instanced ability is tricky. Right now this works for Jump since there is nothing that can go wrong by calling * StopJumping() if you aren't already jumping. If we had a montage playing non instanced ability, it would need to make sure the * Montage that *it* played was still playing, and if so, to cancel it. If this is something we need to support, we may need some * light weight data structure to represent 'non intanced abilities in action' with a way to cancel/end them. */ void UGameplayAbility_CharacterJump::CancelAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateCancelAbility) { Super::CancelAbility(Handle, ActorInfo, ActivationInfo, bReplicateCancelAbility); ACharacter * Character = CastChecked<ACharacter>(ActorInfo->AvatarActor.Get()); Character->StopJumping(); }
/** * Canceling an non instanced ability is tricky. Right now this works for Jump since there is nothing that can go wrong by calling * StopJumping() if you aren't already jumping. If we had a montage playing non instanced ability, it would need to make sure the * Montage that *it* played was still playing, and if so, to cancel it. If this is something we need to support, we may need some * light weight data structure to represent 'non intanced abilities in action' with a way to cancel/end them. */ void UGameplayAbility_CharacterJump::CancelAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateCancelAbility) { if (ScopeLockCount > 0) { WaitingToExecute.Add(FPostLockDelegate::CreateUObject(this, &UGameplayAbility_CharacterJump::CancelAbility, Handle, ActorInfo, ActivationInfo, bReplicateCancelAbility)); return; } Super::CancelAbility(Handle, ActorInfo, ActivationInfo, bReplicateCancelAbility); ACharacter * Character = CastChecked<ACharacter>(ActorInfo->AvatarActor.Get()); Character->StopJumping(); }