UGCProjects/Counterattack/Script/Global/BuffSystem/BuffAction/BuffAction_MoveSpeedStrengthen.lua

47 lines
1.8 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
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
self:SetSpeedScale(OwnerPawn, self: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
self:SetSpeedScale(OwnerPawn, self:GetSpeedScale(OwnerPawn) / self.SpeedScale)
else
UGCLogSystem.Log("[BuffAction_MoveSpeedStrengthen_LuaUndoAction] PlayerDeath or Player is nil")
end
end
function BuffAction_MoveSpeedStrengthen:SetSpeedScale(OwnerPawn, SpeedScale)
-- UGCPawnAttrSystem.SetSpeedScale(OwnerPawn, UGCPawnAttrSystem.GetSpeedScale(OwnerPawn) * self.SpeedScale)
-- OwnerPawn:SetMoveSpeedModifier(self:GetSpeedScale(OwnerPawn) * self.SpeedScale)
--OwnerPawn:SetSpeedScaleUGC(self:GetSpeedScale(OwnerPawn) * self.SpeedScale)
OwnerPawn:SetEnergySpeedScaleUGC(SpeedScale) -- 走路速度
UGCPawnAttrSystem.SetSprintSpeedScale(OwnerPawn, SpeedScale) -- 冲刺速度
end
function BuffAction_MoveSpeedStrengthen:GetSpeedScale(OwnerPawn)
--return OwnerPawn:GetMoveSpeedModifier()
return OwnerPawn:GetEnergySpeedScaleUGC()
end
return BuffAction_MoveSpeedStrengthen;