30 lines
		
	
	
		
			809 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			809 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using UnrealSharp;
 | |
| using UnrealSharp.Attributes;
 | |
| using UnrealSharp.BusyRabbit;
 | |
| using UnrealSharp.CoreUObject;
 | |
| using UnrealSharp.Engine;
 | |
| 
 | |
| namespace Level.GameSettings;
 | |
| 
 | |
| [UClass]
 | |
| public class ABusyLevelPlayerState : ALevelPlayerState
 | |
| {
 | |
|     protected override void BeginPlay()
 | |
|     {
 | |
|         base.BeginPlay();
 | |
|         APlayerController pc = UGameplayStatics.GetPlayerController(0);
 | |
|         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);
 | |
|         }
 | |
|     }
 | |
| }
 |