Source/BattleRoyale/core/Abilities/AbilityJump.cpp
// Epic's comment
/**
 *	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.
 */
Epic's comment
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.
Epic ' s comment 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 UAbilityJump::CancelAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo,
                                   const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateCancelAbility)
{
	if (ScopeLockCount > 0)
	{
		WaitingToExecute.Add(FPostLockDelegate::CreateUObject(this, &UAbilityJump::CancelAbility, Handle, ActorInfo,
		                                                      ActivationInfo, bReplicateCancelAbility));
		return;
	}
	Super::CancelAbility(Handle, ActorInfo, ActivationInfo, bReplicateCancelAbility);
	const auto character = GetCharacter(ActorInfo);
	if (character != nullptr)
	{
		UAbilitySystemGlobals::Get().GetGameplayCueManager()->HandleGameplayCue(
				ActorInfo->AvatarActor.Get(),
				FGameplayTag::RequestGameplayTag(FName("GameplayCue.Jump")),
				EGameplayCueEvent::Type::Removed,
				FGameplayCueParameters());
		character->StopJumping_();
	}
}
void UAbilityJump :: CancelAbility ( const FGameplayAbilitySpecHandle Handle , const FGameplayAbilityActorInfo * ActorInfo , const FGameplayAbilityActivationInfo ActivationInfo , bool bReplicateCancelAbility ) { if ( ScopeLockCount > 0 ) { WaitingToExecute . Add ( FPostLockDelegate :: CreateUObject ( this , & UAbilityJump :: CancelAbility , Handle , ActorInfo , ActivationInfo , bReplicateCancelAbility ) ) ; return ; } Super :: CancelAbility ( Handle , ActorInfo , ActivationInfo , bReplicateCancelAbility ) ; const auto character = GetCharacter ( ActorInfo ) ; if ( character != nullptr ) { UAbilitySystemGlobals :: Get ( ) . GetGameplayCueManager ( ) -> HandleGameplayCue ( ActorInfo -> AvatarActor . Get ( ) , FGameplayTag :: RequestGameplayTag ( FName ( " " ) ) , EGameplayCueEvent :: Type :: Removed , FGameplayCueParameters ( ) ) ; character -> StopJumping_ ( ) ; } }
Epic's comment
      Canceling an non instanced ability is tricky.
Epic ' s comment Canceling an non instanced ability is tricky .