UGCProjects/BreakThrough/Script/Global/BuffSystem/BuffAction/BuffAction_MoveSpeedStrengthen.lua
2025-01-04 23:00:19 +08:00

32 lines
1.1 KiB
Lua

local BuffActionBase = require('Script.Global.BuffSystem.BuffActionBase')
local BuffAction_MoveSpeedStrengthen = setmetatable(
{
SpeedScale = 1.
},
{ __index = BuffActionBase, __metatable = BuffActionBase }
);
function BuffAction_MoveSpeedStrengthen:LuaDoAction()
BuffActionBase.LuaDoAction(self)
if not UGCGameSystem.IsServer() then return true end
UGCLogSystem.Log("[BuffAction_MoveSpeedStrengthen_LuaDoAction]")
local OwnerPawn = self:GetOwnerPawn()
if UE.IsValid(OwnerPawn) then
UGCPawnAttrSystem.SetSpeedScale(OwnerPawn, UGCPawnAttrSystem.GetSpeedScale(OwnerPawn) * self.SpeedScale)
end
return true
end
function BuffAction_MoveSpeedStrengthen:LuaUndoAction()
BuffActionBase.LuaUndoAction(self)
if not UGCGameSystem.IsServer() then return true end
UGCLogSystem.Log("[BuffAction_MoveSpeedStrengthen_LuaUndoAction]")
local OwnerPawn = self:GetOwnerPawn()
if UE.IsValid(OwnerPawn) then
UGCPawnAttrSystem.SetSpeedScale(OwnerPawn, UGCPawnAttrSystem.GetSpeedScale(OwnerPawn) / self.SpeedScale)
end
end
return BuffAction_MoveSpeedStrengthen;