Files
BusyRabbit/Script/ManagedBusyRabbit/Level/GameSettings/BusyLevelPlayerState.cs
wyatt 39b100acff 优化角色生成位置 #2
同时也将地图扩大为128 * 128
2025-10-30 23:11:08 +08:00

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