0
点赞
收藏
分享

微信扫一扫

Git基本用法总结

左手梦圆 2024-09-26 阅读 2
ue5

一、在蓝图中创建接口
1、创建BlueprintInterface
2、声明接口函数
在这里插入图片描述
在这里插入图片描述
3、继承接口
在这里插入图片描述
在这里插入图片描述
注意,接口不需要绑定Lua,也没有Bind按钮
二、在Lua中实现接口函数
1、实现接口函数
BP_Player.lua

function BP_Player_C:UpdateAiming(IsAiming)
	if IsAiming then
		self.ZoomInOut:Play()		--0变化到1
	else
		self.ZoomInOut:Reverse()	--1变化到0
	end
end

2、调用接口函数
BP_PlayerController.lua

function BP_PlayerController_C:Aim_Pressed()
	--self.Pawn:UpdateAiming(true)	--FOV增加,广角

	--local MyInterface = UE.UBPI_Interfaces_C 	--获取Interface元表,弃用
	--MyInterface.UpdateAiming(self.Pawn,true)	--弃用
	local BPI_Interfaces = UE.UClass.Load("/Game/ShootingScripts/Blueprint/Common/BP_Interfaces.BP_Interfaces_C")
	BPI_Interfaces.UpdateAiming(self.Pawn,true)
end
举报

相关推荐

0 条评论