Files
Nerfed/Nerfed.Runtime/Scheduling/SystemScheduleEntry.cs
T

38 lines
1.1 KiB
C#

using MoonTools.ECS;
namespace Nerfed.Runtime.Scheduling;
public sealed class SystemScheduleEntry
{
public SystemScheduleEntry(
MoonTools.ECS.System system,
SystemSchedulePhase phase,
string[] dependsOn,
int registrationIndex)
{
System = system;
Phase = phase;
DependsOn = dependsOn ?? Array.Empty<string>();
RegistrationIndex = registrationIndex;
if (system is IParallelSystemMetadata metadata)
{
Name = metadata.ScheduleName;
Access = metadata.AccessDeclaration;
}
else
{
Name = system.GetType().Name;
// Unknown systems are treated as structural to preserve safety until metadata is declared.
Access = new SystemAccessDeclaration(new ComponentAccess(typeof(object), SystemAccessMode.StructuralWrite));
}
}
public MoonTools.ECS.System System { get; }
public string Name { get; }
public SystemSchedulePhase Phase { get; }
public string[] DependsOn { get; }
public int RegistrationIndex { get; }
public SystemAccessDeclaration Access { get; }
}