UE C++ Play Montage

UE C++ Play Montage

直接贴代码

引擎源代码

AnimInstance.h

Delegates

////////////////// Montage Start

/**
* Delegate for when Montage is started
*/
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMontageStartedMCDelegate, UAnimMontage*, Montage);

////////////////// Montage End

/**
* Delegate for when Montage is completed, whether interrupted or finished
* Weight of this montage is 0.f, so it stops contributing to output pose
*
* bInterrupted = true if it was not property finished
*/
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnMontageEndedMCDelegate, UAnimMontage*, Montage, bool, bInterrupted);

////////////////// Blend In

/** Delegate for when Montage finished blending in */
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMontageBlendedInEndedMCDelegate, UAnimMontage*, Montage);

////////////////// Blend Out

/**
* Delegate for when Montage started to blend out, whether interrupted or finished
* DesiredWeight of this montage becomes 0.f, but this still contributes to the output pose
*
* bInterrupted = true if it was not property finished
*/
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnMontageBlendingOutStartedMCDelegate, UAnimMontage*, Montage, bool, bInterrupted);

Delegate 声明

/** Called when a montage starts blending out, whether interrupted or finished */
UPROPERTY(BlueprintAssignable)
FOnMontageBlendingOutStartedMCDelegate OnMontageBlendingOut;

/** Called when a montage finishes blending in */
UPROPERTY(BlueprintAssignable)
FOnMontageBlendedInEndedMCDelegate OnMontageBlendedIn;
	
/** Called when a montage has started */
UPROPERTY(BlueprintAssignable)
FOnMontageStartedMCDelegate OnMontageStarted;

/** Called when a montage has ended, whether interrupted or finished*/
UPROPERTY(BlueprintAssignable)
FOnMontageEndedMCDelegate OnMontageEnded;

调用
GetCharacter()->PlayAnimMontage(UAnimMontage*);

GetCharacter()->GetAnimInstance()->{Delegate声明的内容}.AddDynamic(this, &类::绑定方法);

 
© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容