Lua向C#逻辑迁移 一期

创建了若干C#文件,替代对应lua文件
This commit is contained in:
2025-10-25 05:53:20 +08:00
parent fc1078f20c
commit dab9990b44
25 changed files with 336 additions and 5411 deletions

View File

@ -0,0 +1,32 @@
using UnrealSharp.Attributes;
using UnrealSharp.Engine;
namespace Level.GameSettings;
[UClass]
public class ABusyLevelGameMode : AGameMode
{
[UProperty(PropertyFlags.EditDefaultsOnly)]
public UnrealSharp.TSubclassOf<AActor> GameMapActorClass { get; set; }
protected override void BeginPlay()
{
base.BeginPlay();
if (GameMapActorClass.Valid)
{
SpawnActor(GameMapActorClass);
}
}
}
// -- function LevelGameMode:K2_PostLogin(new_player_controller)
// -- local new_player_state = new_player_controller.PlayerState
// -- local role = new_player_state:CreateRoleRoster(new_player_controller)
// -- local new_pos = FVector()
// -- new_pos.X = 500
// -- new_pos.Y = 500
// -- new_pos.Z = 50
// -- role:K2_SetActorLocation(new_pos, true, nil, false)
// -- new_player_controller:Possess(role)
// -- end

View File

@ -0,0 +1,17 @@
using UnrealSharp.Attributes;
using UnrealSharp.BusyRabbit;
using UnrealSharp.Engine;
namespace Level.GameSettings;
[UClass]
public class ABusyLevelPlayerState : ALevelPlayerState
{
protected override void BeginPlay()
{
base.BeginPlay();
APlayerController pc = UGameplayStatics.GetPlayerController(0);
var role = CreateRoleRoster(pc) as APawn;
pc.Possess(role);
}
}