2025-01-04 23:00:19 +08:00

87 lines
2.4 KiB
Lua

---@class BP_CheckPoints_C:AActor
---@field FX_Hide UParticleSystemComponent
---@field FX_Loop UParticleSystemComponent
---@field Sphere USphereComponent
---@field Arrow UArrowComponent
---@field Box UBoxComponent
---@field DefaultSceneRoot USceneComponent
---@field PointIndex TEnumAsByte<EPlayerStartType>
---@field IsDestination bool
---@field DestinationSound UAkAudioEvent
---@field DefaultSound UAkAudioEvent
--Edit Below--
local BP_CheckPoints = {
OverlapPlayers = {};
};
function BP_CheckPoints:ReceiveBeginPlay()
self.SuperClass.ReceiveBeginPlay(self);
if UGCGameSystem.IsServer() then
UGCSystemLibrary.BindBeginOverlapFunc(self.Box, self.PlayerOverlapCheckPoint, self)
else
if self.PointIndex == 0 then
self.FX_Loop:SetActive(false, false)
end
end
end
function BP_CheckPoints:PlayerOverlapCheckPoint(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult)
if OtherActor and OtherActor.PlayerKey and not table.hasValue(self.OverlapPlayers, OtherActor.PlayerKey) then
self.OverlapPlayers[#self.OverlapPlayers + 1] = OtherActor.PlayerKey
UGCEventSystem.SendEvent(EventEnum.OverlapCheckPoint, OtherActor.PlayerKey, self.PointIndex, self.IsDestination)
if self.PointIndex > 0 then
UGCSendRPCSystem.ActorRPCNotify(OtherActor.PlayerKey, self, "ClientEffect")
end
end
end
function BP_CheckPoints:ResetCheckPoint()
self.OverlapPlayers = {}
UGCSendRPCSystem.ActorRPCNotify(nil, self, "ResetClientEffect")
end
function BP_CheckPoints:GetPointIndex()
return self.PointIndex
end
function BP_CheckPoints:ResetClientEffect()
self.FX_Loop:SetActive(true, true)
self.FX_Hide:SetActive(false, false)
end
function BP_CheckPoints:ClientEffect()
if self.IsDestination then
UGCSoundManagerSystem.PlaySound2D(self.DestinationSound)
else
UGCSoundManagerSystem.PlaySound2D(self.DefaultSound)
end
self.FX_Loop:SetActive(false, false)
self.FX_Hide:SetActive(true, true)
end
--[[
function BP_CheckPoints:ReceiveTick(DeltaTime)
self.SuperClass.ReceiveTick(self, DeltaTime);
end
--]]
--[[
function BP_CheckPoints:ReceiveEndPlay()
self.SuperClass.ReceiveEndPlay(self);
end
--]]
--[[
function BP_CheckPoints:GetReplicatedProperties()
return
end
--]]
--[[
function BP_CheckPoints:GetAvailableServerRPCs()
return
end
--]]
return BP_CheckPoints;