UGCProjects/ProjectTemp_T/Script/Blueprint/BUFF/BuffAction/BuffAction_ScalePlayerMesh.lua
2025-01-04 23:00:19 +08:00

34 lines
1.5 KiB
Lua

local BuffAction_ScalePlayerMesh = {
BuffColor = {R = 0.97, G = 0.88, B = 0.1, A = 1.};
BuffIconPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Texture/BUFFIcon/T_ReducePerson.T_ReducePerson');
BuffParticlePath = UGCGameSystem.GetUGCResourcesFullPath('Asset/FX/P_ReducePerson.P_ReducePerson');
BuffDesc = "缩放玩家";
}
function BuffAction_ScalePlayerMesh:ApplyBuff(BuffTag, ValidPawn, MulScale)
if MulScale == nil or type(MulScale) ~= "number" then
return false
end
self:MeshMulScale(ValidPawn, MulScale)
BP_BuffManager.GetBuffManager():BuffNotifyRPC(nil, BP_BuffManager.GetBuffFileName(), "MeshMulScale", ValidPawn, MulScale)
return true
end
function BuffAction_ScalePlayerMesh:RemoveBuff(BuffTag, ValidPawn, MulScale)
self:MeshMulScale(ValidPawn, 1./MulScale)
BP_BuffManager.GetBuffManager():BuffNotifyRPC(nil, BP_BuffManager.GetBuffFileName(), "MeshMulScale", ValidPawn, 1./MulScale)
end
function BuffAction_ScalePlayerMesh:MeshMulScale(ValidPawn, MulScale)
if UE.IsValid(ValidPawn) then
local MeshScale = ValidPawn.Mesh:K2_GetComponentScale()
local TargetScale = {X = MeshScale.X * MulScale, Y = MeshScale.Y * MulScale, Z = MeshScale.Z * MulScale}
ValidPawn.Mesh:SetWorldScale3D(TargetScale)
end
end
function BuffAction_ScalePlayerMesh:PlayerDeathCallBack(PlayerKey)
UGCLogSystem.Log("[BuffAction_ScalePlayerMesh_PlayerDeathCallBack] PlayerKey:%d", PlayerKey)
end
return BuffAction_ScalePlayerMesh