Last active
July 18, 2018 04:23
-
-
Save michaeltchapman/c5d5b81bd3c2df606e744cacf1726ac4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in AbilitySystemComponent child class | |
void UAsyncAbilitySystemComponent::SetCurrentMontageTask(UAbilityTask_MontageWithNotifies* MontageTask) | |
{ | |
CurrentMontageTask = MontageTask; | |
} | |
void UAsyncAbilitySystemComponent::ClearCurrentMontageTask() | |
{ | |
CurrentMontageTask = nullptr; | |
} | |
void UAsyncAbilitySystemComponent::NotifyCurrentMontageTask(FName Name) | |
{ | |
// This will only fire on the predicting client and on the server since the montage task is not simulated | |
if (CurrentMontageTask) | |
{ | |
CurrentMontageTask->OnNotifyNamed.Broadcast(Name); | |
} | |
AbilityNotifyDelegate.Broadcast(Name); | |
} | |
// in the montage play task Activate(): | |
UAsyncAbilitySystemComponent* AASC = Cast<UAsyncAbilitySystemComponent>(AbilitySystemComponent); | |
if (AASC) | |
{ | |
AASC->SetCurrentMontageTask(this); | |
} | |
// and in the Destroy(): | |
UAsyncAbilitySystemComponent* AASC = Cast<UAsyncAbilitySystemComponent>(AbilitySystemComponent); | |
if (AASC) | |
{ | |
AASC->ClearCurrentMontageTask(); | |
} | |
// in new AnimNotify: | |
void UAbilityAnimNotify::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation) | |
{ | |
Super::Notify(MeshComp, Animation); | |
UAsyncAbilitySystemComponent* ASC = Cast<UAsyncAbilitySystemComponent>(UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(MeshComp->GetOwner())); | |
if (ASC) | |
{ | |
ASC->NotifyCurrentMontageTask(NotifyName); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment