90 lines
2.2 KiB
Lua
90 lines
2.2 KiB
Lua
---@class BP_Star_C:AActor
|
|
---@field StarParticle UParticleSystemComponent
|
|
---@field OverlapCmp USphereComponent
|
|
---@field DefaultSceneRoot USceneComponent
|
|
--Edit Below--
|
|
local BP_Star = {
|
|
bEnableStar = false;
|
|
};
|
|
|
|
|
|
function BP_Star:ReceiveBeginPlay()
|
|
self.SuperClass.ReceiveBeginPlay(self);
|
|
UGCLogSystem.Log("[BP_Star_ReceiveBeginPlay]")
|
|
if UGCGameSystem.IsServer() then
|
|
UGCSystemLibrary.BindBeginOverlapFunc(self.OverlapCmp, self.OverlapPlayer, self)
|
|
else
|
|
self:OnRep_bEnableStar()
|
|
end
|
|
end
|
|
|
|
|
|
|
|
--[[
|
|
function BP_Star:ReceiveTick(DeltaTime)
|
|
self.SuperClass.ReceiveTick(self, DeltaTime);
|
|
end
|
|
--]]
|
|
|
|
--[[
|
|
function BP_Star:ReceiveEndPlay()
|
|
self.SuperClass.ReceiveEndPlay(self);
|
|
end
|
|
--]]
|
|
|
|
|
|
function BP_Star:GetReplicatedProperties()
|
|
return
|
|
"bEnableStar"
|
|
end
|
|
|
|
|
|
--[[
|
|
function BP_Star:GetAvailableServerRPCs()
|
|
return
|
|
end
|
|
--]]
|
|
|
|
|
|
function BP_Star:OverlapPlayer(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult)
|
|
if self.bEnableStar and OtherActor.PlayerKey and OtherActor:IsAlive() then
|
|
self:SetStarEnable(false, true)
|
|
UGCEventSystem.SendEvent(EventEnum.PlayerPickStar, OtherActor.PlayerKey)
|
|
end
|
|
end
|
|
|
|
function BP_Star:GetEnableStar()
|
|
return self.bEnableStar
|
|
end
|
|
|
|
function BP_Star:SetStarEnable(bEnable, NotifyClient)
|
|
UGCLogSystem.Log("[BP_Star_SetStarEnable] bEnable:%s", tostring(bEnable))
|
|
if bEnable ~= self.bEnableStar then
|
|
self.bEnableStar = bEnable
|
|
if NotifyClient then
|
|
UGCSendRPCSystem.ActorRPCNotify(nil, self, "ClientUpdateEnableEffect", self.bEnableStar)
|
|
end
|
|
UGCLogSystem.Log("[BP_Star_SetStarEnable] Finish")
|
|
end
|
|
end
|
|
|
|
function BP_Star:ClientUpdateEnableEffect(bEnable)
|
|
self.StarParticle:SetHiddenInGame(not bEnable)
|
|
UGCLogSystem.Log("[BP_Star_ClientUpdateEnableEffect] bEnable:%s", tostring(bEnable))
|
|
end
|
|
|
|
function BP_Star:OnRep_bEnableStar()
|
|
if self.bEnableStar then
|
|
self:ClientUpdateEnableEffect(true)
|
|
end
|
|
end
|
|
|
|
function BP_Star:SetPos(NewPos, NotifyClient)
|
|
self:K2_SetActorLocation(NewPos)
|
|
if UGCGameSystem.IsServer() and NotifyClient then
|
|
UGCSendRPCSystem.ActorRPCNotify(nil, self, "SetPos", VectorHelper.ToLuaTable(NewPos))
|
|
end
|
|
end
|
|
|
|
|
|
return BP_Star; |