优化角色生成位置 #2

同时也将地图扩大为128 * 128
This commit is contained in:
2025-10-30 23:11:08 +08:00
parent 239425c47d
commit 39b100acff
18 changed files with 84 additions and 23 deletions

View File

@ -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);
}
}
}