阶段暂存
This commit is contained in:
@ -1,13 +1,36 @@
|
||||
local Vector = import("Vector")
|
||||
local GameplayStatics = import("GameplayStatics")
|
||||
local BusyGameplayLibrary = import("BusyGameplayLibrary")
|
||||
|
||||
--- 保留到以后做联机内容时拓展
|
||||
--- @class LevelGameMode
|
||||
--- @field GameMapActorClass table
|
||||
local LevelGameMode = {}
|
||||
|
||||
function LevelGameMode:K2_PostLogin(new_player_controller)
|
||||
|
||||
local new_player_state = new_player_controller.PlayerState
|
||||
|
||||
local role = new_player_state:CreateRoleRoster(new_player_controller)
|
||||
|
||||
new_player_controller:Possess(role)
|
||||
|
||||
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)
|
||||
Reference in New Issue
Block a user