5,动画蓝图类接口转c++

蓝图中有个动画接口类传递连击index和角色是否在攻击,确定播放哪个攻击动画,

这里也改成C++

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"

#include "UObject/Interface.h"

#include "BPI_Anims.generated.h"

// This class does not need to be modified.

UINTERFACE(MinimalAPI)

class UBPI_Anims : public UInterface

{

GENERATED_BODY()

};

/**

*

*/

class ROUGHLIKE1_API IBPI_Anims

{

GENERATED_BODY()

复制代码
// Add interface functions to this class. This is the class that will be inherited to implement this interface.

public:

UFUNCTION(BlueprintNativeEvent, BlueprintCallable,Category = "Anim Interface")

void INT_SetAttacks(int32 comboIndex, bool IsAttacking);

};

在角色类添加

public:

//调用攻击动画接口类

UFUNCTION(BlueprintCallable, Category = "Animation")

void SetAnimAttack(int32 comboIndex, bool bIsAttacking);

void AMyPaperZDCharacter::SetAnimAttack(int32 comboIndex, bool bIsAttacking)

{

//获取动画组件

UPaperZDAnimationComponent* animComp = GetAnimationComponent();

if (!animComp)

{

return;

}

//获取动画实例

UPaperZDAnimInstance* animInstance = animComp->GetAnimInstance();

if (!animInstance)

{

return;

}

//检查是否实现接口

if (animInstance->Implements<UBPI_Anims>())

{

IBPI_Anims::Execute_INT_SetAttacks(animInstance, comboIndex, bIsAttacking);

}

}

改后,把以前的蓝图接口类删除,

在角色类中变为

动画蓝图类中替换为新接口,

相关推荐
日月云棠2 天前
UE5 Lyra源码分析——Audio_Analysis音频模块全面分析
ue5·音视频
成都渲染101云渲染66662 天前
2026云渲染平台哪个好?建筑、动画、UE5项目选择云渲染的3个关键标准
ue5
清泓y2 天前
UE 物理系统知识分享
面试·ue5·游戏程序
清泓y3 天前
UE移动开发技术面试题
android·面试·ue5·ue4·游戏程序
清泓y3 天前
UE基础知识与引擎架构面试题
面试·架构·ue5·ue4·游戏程序
mengzhi啊5 天前
UE5关卡切换 传统加载(阻塞)vs流式加载(非阻塞)。还有加载关卡3种办法
ue5
电子云与长程纠缠5 天前
UE中使用TGuardValue与TInlineComponentArray数据结构
开发语言·数据结构·学习·ue5·游戏引擎
Duo1J7 天前
【UE】Slate 编辑器工具开发03 - 节点编辑器 (EdGraph)
ue5·编辑器·游戏引擎·ue4
directx3d_beginner8 天前
26,怪物受击接口改为C++
ue5
远离UE410 天前
UE5 UV邻接 Niagara潜水模拟 学习笔记
ue5·uv