Files
BusyRabbit/Content/Lua/Level/LevelGameMode.lua
2025-09-30 02:52:12 +08:00

45 lines
1.3 KiB
Lua

local Vector = import("Vector")
local GameplayStatics = import("GameplayStatics")
local BusyGameplayLibrary = import("BusyGameplayLibrary")
--[[****************************私有函数区域******************************]]--
--- 生成资源点
local function GenerateResourcePoint()
end
--- 保留到以后做联机内容时拓展
--- @class LevelGameMode
--- @field GameMapActorClass table
local LevelGameMode = {}
function LevelGameMode:ctor()
self.map_actor = nil
end
function LevelGameMode:ReceiveBeginPlay()
print("LevelGameMode:ReceiveBeginPlay", self.GameMapActorClass)
local world = BusyGameplayLibrary.K2_GetWorld(self)
local game_state = GameplayStatics.GetGameState(self) --- @type LevelGameState
if self.GameMapActorClass then
local map_actor = world:SpawnActor(self.GameMapActorClass, Vector(), nil, nil)
game_state:SetGameMapActor(map_actor)
end
end
-- function LevelGameMode:K2_PostLogin(new_player_controller)
-- local new_player_state = new_player_controller.PlayerState
-- local role = new_player_state:CreateRoleRoster(new_player_controller)
-- local new_pos = FVector()
-- new_pos.X = 500
-- new_pos.Y = 500
-- new_pos.Z = 50
-- role:K2_SetActorLocation(new_pos, true, nil, false)
-- new_player_controller:Possess(role)
-- end
return Class(nil, nil, LevelGameMode)