48 lines
1.2 KiB
Lua
48 lines
1.2 KiB
Lua
local Buff_AddSpeed = {};
|
|
|
|
--- 下面的可以直接用,就能获取到值
|
|
Buff_AddSpeed.OwnerPlayerKey = nil;
|
|
Buff_AddSpeed.BuffType = nil;
|
|
Buff_AddSpeed.Owner = nil;
|
|
Buff_AddSpeed.BuffName = nil;
|
|
|
|
function Buff_AddSpeed:Init(Params)
|
|
return true;
|
|
end
|
|
|
|
function Buff_AddSpeed:AddBuff(Pawn)
|
|
if IsServer then
|
|
UGCPawnAttrSystem.SetSpeedScale(Pawn, UGCPawnAttrSystem.GetSpeedScale(Pawn) + self.AddSpeed);
|
|
else
|
|
self:RemoveEmitter();
|
|
self.Emitter = UE.SpawnEmitterAttached(self.Particle, Pawn);
|
|
end
|
|
return true;
|
|
end
|
|
|
|
function Buff_AddSpeed:RemoveBuff(Pawn)
|
|
UGCLogSystem.Log("[Buff_AddSpeed:RemoveBuff] 移除 Buff, PlayerName = %s", UGCPawnAttrSystem.GetPlayerName(Pawn));
|
|
if IsServer then
|
|
UGCPawnAttrSystem.SetSpeedScale(Pawn, UGCPawnAttrSystem.GetSpeedScale(Pawn) - self.AddSpeed);
|
|
else
|
|
self:RemoveEmitter();
|
|
end
|
|
return true;
|
|
end
|
|
|
|
function Buff_AddSpeed:RemoveEmitter()
|
|
if self.Emitter then
|
|
self.Emitter:K2_DestroyComponent(self.Emitter);
|
|
end
|
|
end
|
|
|
|
function Buff_AddSpeed:UpdateBuff(...)
|
|
|
|
end
|
|
|
|
function Buff_AddSpeed:Reset(Params)
|
|
-- 默认使用初始化重置,也可以不用
|
|
self:Init(Params);
|
|
end
|
|
|
|
return Buff_AddSpeed; |