2023-03-12 02:02:39 +08:00
|
|
|
|
namespace DCFApixels.DragonECS
|
|
|
|
|
{
|
2023-03-12 20:45:18 +08:00
|
|
|
|
public interface IEcsPreInitSystem : IEcsSystem
|
2023-03-12 02:02:39 +08:00
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
public void PreInit(EcsSystems systems);
|
2023-03-12 02:02:39 +08:00
|
|
|
|
}
|
2023-03-12 20:45:18 +08:00
|
|
|
|
public interface IEcsInitSystem : IEcsSystem
|
2023-03-12 02:02:39 +08:00
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
public void Init(EcsSystems systems);
|
2023-03-12 02:02:39 +08:00
|
|
|
|
}
|
2023-03-12 20:45:18 +08:00
|
|
|
|
public interface IEcsRunSystem : IEcsSystem
|
2023-03-12 02:02:39 +08:00
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
public void Run(EcsSystems systems);
|
2023-03-12 02:02:39 +08:00
|
|
|
|
}
|
2023-03-12 20:45:18 +08:00
|
|
|
|
public interface IEcsDestroySystem : IEcsSystem
|
2023-03-12 02:02:39 +08:00
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
public void Destroy(EcsSystems systems);
|
2023-03-12 02:02:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-26 11:19:03 +08:00
|
|
|
|
public interface IEcsBaseSystem : IEcsInitSystem, IEcsRunSystem, IEcsDestroySystem { }
|
2023-03-12 02:02:39 +08:00
|
|
|
|
|
|
|
|
|
public sealed class EcsPreInitRunner : EcsRunner<IEcsPreInitSystem>, IEcsPreInitSystem
|
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
void IEcsPreInitSystem.PreInit(EcsSystems systems)
|
2023-03-12 02:02:39 +08:00
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
foreach (var item in targets) item.PreInit(systems);
|
2023-03-12 02:02:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public sealed class EcsInitRunner : EcsRunner<IEcsInitSystem>, IEcsInitSystem
|
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
void IEcsInitSystem.Init(EcsSystems systems)
|
2023-03-12 02:02:39 +08:00
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
foreach (var item in targets) item.Init(systems);
|
2023-03-12 02:02:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public sealed class EcsRunRunner : EcsRunner<IEcsRunSystem>, IEcsRunSystem
|
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
void IEcsRunSystem.Run(EcsSystems systems)
|
2023-03-12 02:02:39 +08:00
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
foreach (var item in targets) item.Run(systems);
|
2023-03-12 02:02:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public sealed class EcsDestroyRunner : EcsRunner<IEcsDestroySystem>, IEcsDestroySystem
|
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
void IEcsDestroySystem.Destroy(EcsSystems systems)
|
2023-03-12 02:02:39 +08:00
|
|
|
|
{
|
2023-03-26 11:19:03 +08:00
|
|
|
|
foreach (var item in targets) item.Destroy(systems);
|
2023-03-12 02:02:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|