| 
									
										
										
										
											2025-09-28 01:32:54 +08:00
										 |  |  | local Vector = import("Vector") | 
					
						
							|  |  |  | local GameplayStatics = import("GameplayStatics") | 
					
						
							|  |  |  | local BusyGameplayLibrary = import("BusyGameplayLibrary") | 
					
						
							| 
									
										
										
										
											2025-09-24 14:09:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-30 02:52:12 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | --[[****************************私有函数区域******************************]]-- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | --- 生成资源点 | 
					
						
							|  |  |  | local function GenerateResourcePoint() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-28 01:32:54 +08:00
										 |  |  | --- 保留到以后做联机内容时拓展 | 
					
						
							|  |  |  | --- @class LevelGameMode | 
					
						
							|  |  |  | --- @field GameMapActorClass table | 
					
						
							|  |  |  | local LevelGameMode = {} | 
					
						
							| 
									
										
										
										
											2025-09-24 14:09:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-28 01:32:54 +08:00
										 |  |  | function LevelGameMode:ctor() | 
					
						
							|  |  |  |     self.map_actor = nil | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2025-09-24 14:09:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-28 01:32:54 +08:00
										 |  |  | function LevelGameMode:ReceiveBeginPlay() | 
					
						
							|  |  |  |     print("LevelGameMode:ReceiveBeginPlay", self.GameMapActorClass) | 
					
						
							|  |  |  |     local world = BusyGameplayLibrary.K2_GetWorld(self) | 
					
						
							|  |  |  |     local game_state = GameplayStatics.GetGameState(self) --- @type LevelGameState | 
					
						
							| 
									
										
										
										
											2025-09-24 14:09:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-28 01:32:54 +08:00
										 |  |  |     if self.GameMapActorClass then | 
					
						
							|  |  |  |         local map_actor = world:SpawnActor(self.GameMapActorClass, Vector(), nil, nil) | 
					
						
							|  |  |  |         game_state:SetGameMapActor(map_actor) | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2025-09-24 14:09:51 +08:00
										 |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-28 01:32:54 +08:00
										 |  |  | -- 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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-24 14:09:51 +08:00
										 |  |  | return Class(nil, nil, LevelGameMode) |