90 lines
2.7 KiB
Lua
90 lines
2.7 KiB
Lua
|
---@class BP_PlayerAddBuff_C:AActor
|
||
|
---@field P_Buff_Enable UParticleSystemComponent
|
||
|
---@field Capsule UCapsuleComponent
|
||
|
---@field BuffWidget2 UWidgetComponent
|
||
|
---@field BuffWidget UWidgetComponent
|
||
|
---@field Scene USceneComponent
|
||
|
---@field P_Buff UParticleSystemComponent
|
||
|
---@field DefaultSceneRoot USceneComponent
|
||
|
---@field RotatorSpeed float
|
||
|
---@field UpDownSpeed float
|
||
|
---@field HeightRange float
|
||
|
---@field ResetDelayTime float
|
||
|
---@field BuffID int32
|
||
|
--Edit Below--
|
||
|
---@type BP_PlayerAddBuff_C
|
||
|
local BP_PlayerAddBuff = {
|
||
|
IconBeginPositionZ = 150.;
|
||
|
EnableBuffPick = true;
|
||
|
};
|
||
|
|
||
|
|
||
|
function BP_PlayerAddBuff:ReceiveBeginPlay()
|
||
|
self.SuperClass.ReceiveBeginPlay(self);
|
||
|
if self:HasAuthority() then
|
||
|
self.Capsule.OnComponentBeginOverlap:Add(self.PlayerPickUpBuff, self)
|
||
|
else
|
||
|
self.IconBeginPositionZ = self.Scene:GetRelativeTransform().Translation.Z
|
||
|
self:UpdateWidgetIcon()
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function BP_PlayerAddBuff:UpdateWidgetIcon()
|
||
|
self.BuffWidget:GetUserWidgetObject():UpdateIcon(self.BuffID)
|
||
|
self.BuffWidget2:GetUserWidgetObject():UpdateIcon(self.BuffID)
|
||
|
end
|
||
|
|
||
|
|
||
|
|
||
|
function BP_PlayerAddBuff:ReceiveTick(DeltaTime)
|
||
|
self.SuperClass.ReceiveTick(self, DeltaTime);
|
||
|
if self:HasAuthority() then
|
||
|
else
|
||
|
self.Scene:K2_AddLocalRotation({Pitch = 0., Yaw = DeltaTime * self.RotatorSpeed, Row = 0.})
|
||
|
local SceneRelativeZHeight = math.sin(KismetSystemLibrary.GetGameTimeInSeconds(self) * self.UpDownSpeed) * self.HeightRange
|
||
|
self.Scene:K2_SetRelativeLocation({X = 0., Y = 0., Z = self.IconBeginPositionZ + SceneRelativeZHeight})
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function BP_PlayerAddBuff:PlayerPickUpBuff(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult)
|
||
|
if self.EnableBuffPick == false then
|
||
|
return
|
||
|
end
|
||
|
if OtherActor.PlayerKey then
|
||
|
--UGCGameSystem.GameState:PlayerAddBuff(OtherActor.PlayerKey, self.BuffID)
|
||
|
self.EnableBuffPick = false
|
||
|
UnrealNetwork.CallUnrealRPC_Multicast(self, "SetIconVisiblity", false)
|
||
|
UGCEventSystem.SetTimer(self,
|
||
|
function ()
|
||
|
self.EnableBuffPick = true
|
||
|
UnrealNetwork.CallUnrealRPC_Multicast(self, "SetIconVisiblity", true)
|
||
|
end,
|
||
|
self.ResetDelayTime
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function BP_PlayerAddBuff:SetIconVisiblity(IsVis)
|
||
|
self.P_Buff:SetVisibility(not IsVis, false)
|
||
|
self.P_Buff_Enable:SetVisibility(IsVis, false)
|
||
|
self.Scene:SetVisibility(IsVis, true)
|
||
|
end
|
||
|
|
||
|
|
||
|
--[[
|
||
|
function BP_PlayerAddBuff:ReceiveEndPlay()
|
||
|
self.SuperClass.ReceiveEndPlay(self);
|
||
|
end
|
||
|
--]]
|
||
|
|
||
|
--[[
|
||
|
function BP_PlayerAddBuff:GetReplicatedProperties()
|
||
|
return
|
||
|
end
|
||
|
--]]
|
||
|
|
||
|
function BP_PlayerAddBuff:GetAvailableServerRPCs()
|
||
|
return
|
||
|
end
|
||
|
|
||
|
return BP_PlayerAddBuff;
|