---@class UGCPlayerStartManager_C:BP_PlayerStartManager_C ---@field PlayerStartClass UClass --Edit Below-- ---@type UGCPlayerStartManager_C local UGCPlayerStartManager = {}; ---@type table UGCPlayerStartManager.AllPlayerStarts = {}; function UGCPlayerStartManager:ReceiveBeginPlay() self.SuperClass.ReceiveBeginPlay(self); if IsServer then UGCEventSystem.AddListener(EventTypes.ClientAlready, self.OnMapLoaded, self); end end --[[ function UGCPlayerStartManager:ReceiveTick(DeltaTime) self.SuperClass.ReceiveTick(self, DeltaTime); end --]] --[[ function UGCPlayerStartManager:ReceiveEndPlay() self.SuperClass.ReceiveEndPlay(self); end --]] --[[ function UGCPlayerStartManager:GetReplicatedProperties() return end --]] --[[ function UGCPlayerStartManager:GetAvailableServerRPCs() return end --]] function UGCPlayerStartManager:LoadAllPlayerStarts() if self.PlayerStartClass == nil then return end UE.FindActorsByClass(self.PlayerStartClass, self.AllPlayerStarts); UGCLogSystem.LogTree(string.format("[UGCPlayerStartManager:LoadAllPlayerStarts] self.AllPlayerStarts ="), self.AllPlayerStarts) end function UGCPlayerStartManager:OnMapLoaded(LoadedMapIndex, IsLoad) self:LoadAllPlayerStarts(); end ---@param Controller UGCPlayerController_C ---@return BP_STPlayerStart_C function UGCPlayerStartManager:GetUGCModePlayerStart(Controller) if table.isEmpty(self.AllPlayerStarts) then self:LoadAllPlayerStarts() end local PlayerStart = table.func(UGCGameSystem.GameState.MiniGameManager, "SelectPlayerStart", self.AllPlayerStarts, Controller); if PlayerStart and UE.IsValid(PlayerStart) then return PlayerStart; end return self:GetPlayerStart_Internal(Controller); end UGCPlayerStartManager.TestPlayerStart = nil; function UGCPlayerStartManager:GetPlayerStart_Internal(Controller) -- 出生的时候默认使用 local PlayerKey = Controller.PlayerKey; if table.isEmpty(self.AllPlayerStarts) then self:LoadAllPlayerStarts() end local RemoveActorIndies = {}; for i, v in pairs(self.AllPlayerStarts) do if not PoisonManager:IsActorInCircle(v) then table.insert(RemoveActorIndies, i); end end if not table.isEmpty(RemoveActorIndies) then for i = #RemoveActorIndies, 1, -1 do table.remove(self.AllPlayerStarts, RemoveActorIndies[i]); end end if DefaultSettings.EnableTest then UGCLogSystem.Log("[UGCPlayerStartManager:GetPlayerStart_Internal] 执行测试") if self.TestPlayerStart == nil then self.TestPlayerStart = self.AllPlayerStarts[1]; end return self.TestPlayerStart; end if table.isEmpty(self.AllPlayerStarts) then return nil; end return self.AllPlayerStarts[math.random(table.getCount(self.AllPlayerStarts))]; end function UGCPlayerStartManager:Reset() end return UGCPlayerStartManager;