48 lines
991 B
C#
48 lines
991 B
C#
using Ghost.Test.Core;
|
|
|
|
namespace Ghost.Entities.Test;
|
|
|
|
internal class SystemTest : ITest
|
|
{
|
|
private World _world = null!;
|
|
|
|
public void Setup()
|
|
{
|
|
_world = World.Create();
|
|
}
|
|
|
|
public void Run()
|
|
{
|
|
var group = _world.SystemManager.GetSystem<DefaultSystemGroup>();
|
|
group.AddSystem<TestSystemB>();
|
|
group.AddSystem<TestSystemA>();
|
|
|
|
group.SortSystems();
|
|
|
|
var api = new SystemAPI();
|
|
_world.SystemManager.InitializeAll(in api);
|
|
}
|
|
|
|
public void Cleanup()
|
|
{
|
|
_world.Dispose();
|
|
}
|
|
}
|
|
|
|
internal class TestSystemA : SystemBase
|
|
{
|
|
protected override void OnInitialize(ref readonly SystemAPI systemAPI)
|
|
{
|
|
Console.WriteLine("TestSystemA Initialized");
|
|
}
|
|
}
|
|
|
|
[UpdateAfter(typeof(TestSystemA))]
|
|
internal class TestSystemB : SystemBase
|
|
{
|
|
protected override void OnInitialize(ref readonly SystemAPI systemAPI)
|
|
{
|
|
Console.WriteLine("TestSystemB Initialized");
|
|
}
|
|
}
|