| 
									
										
										
										
											2025-10-30 23:11:08 +08:00
										 |  |  | using UnrealSharp; | 
					
						
							| 
									
										
										
										
											2025-10-25 05:53:20 +08:00
										 |  |  | using UnrealSharp.Attributes; | 
					
						
							|  |  |  | using UnrealSharp.BusyRabbit; | 
					
						
							| 
									
										
										
										
											2025-10-30 23:11:08 +08:00
										 |  |  | using UnrealSharp.CoreUObject; | 
					
						
							| 
									
										
										
										
											2025-10-25 05:53:20 +08:00
										 |  |  | using UnrealSharp.Engine; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Level.GameSettings; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [UClass] | 
					
						
							|  |  |  | public class ABusyLevelPlayerState : ALevelPlayerState | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     protected override void BeginPlay() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         base.BeginPlay(); | 
					
						
							|  |  |  |         APlayerController pc = UGameplayStatics.GetPlayerController(0); | 
					
						
							| 
									
										
										
										
											2025-10-30 23:11:08 +08:00
										 |  |  |         UGameplayStatics.GetAllActorsWithTag("Resource.Building.Campsite", out IList<AActor> FoundActors); | 
					
						
							|  |  |  |         FVector SpawnLocation = new FVector(0, 0, 10); | 
					
						
							|  |  |  |         if (FoundActors.Count > 0) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             SpawnLocation = FoundActors[0].ActorLocation; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if(CreateRoleRoster(pc) is APawn Role) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             pc.Possess(Role); | 
					
						
							|  |  |  |             Role.SetActorLocation(SpawnLocation); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-10-25 05:53:20 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | } |