| @ -1,5 +1,7 @@ | ||||
| using UnrealSharp; | ||||
| using UnrealSharp.Attributes; | ||||
| using UnrealSharp.BusyRabbit; | ||||
| using UnrealSharp.CoreUObject; | ||||
| using UnrealSharp.Engine; | ||||
|  | ||||
| namespace Level.GameSettings; | ||||
| @ -11,7 +13,17 @@ public class ABusyLevelPlayerState : ALevelPlayerState | ||||
|     { | ||||
|         base.BeginPlay(); | ||||
|         APlayerController pc = UGameplayStatics.GetPlayerController(0); | ||||
|         var role = CreateRoleRoster(pc) as APawn; | ||||
|         pc.Possess(role); | ||||
|         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); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user