UAnimMontage* ReLoadMontage = UUtilFunctionLibrary::GetAnimMontageFromAssetID(MuzzleConfig.ReLoadMontage);
UAnimInstance* PistolAnim = PistolMeshRef->GetAnimInstance();
if (IsValid(PistolAnim))
{
FAlphaBlend AlphaBlend;
AlphaBlend.SetBlendTime(0.2f);
AlphaBlend.SetBlendOption(EAlphaBlendOption::Linear);
ReLoadMontage->BlendIn = AlphaBlend;
ReLoadMontage->BlendOut = AlphaBlend;
float AnimMontageSecond = PistolAnim->Montage_Play(ReLoadMontage);
PistolAnim->OnMontageBlendingOut.AddDynamic(this, &AHostCharacter::BlendOut);
}
UAnimMontage* UUtilFunctionLibrary::GetAnimMontageFromAssetID(TAssetPtr<UAnimMontage> AssetID)
{
if (AssetID.IsNull())
{
return nullptr;
}
UAnimMontage* AnimMontage = AssetID.Get();
if (AnimMontage == nullptr)
{
AnimMontage = AssetID.LoadSynchronous();
}
return AnimMontage;
}