public void ExecuteSystem(int entityId, ECSDefine.SystemType systemType, BaseSystem.SystemExpandData expandData) { BaseEntity entity = ECSUnit.GetEntity(entityId); if (entity == null) { Debug.LogError($"[ECSModule] ExecuteSystem Fail. Entity Is nil. entityId:{entityId}"); return; } int systemId = systemIdDistributionChunk.Pop(); BaseSystem system = CreateImmediatelyExecuteSystem(systemType, systemId); if (system == null) { return; } do { if (system.GetSystemFunctionType() != ECSDefine.SystemFunctionType.Logic) { Debug.LogError($"[ECSModule] ExecuteSystem Fail. Only Can ImmediatelyExecute Logic Type. entityId:{entityId} systemType:{Enum.GetName(typeof(ECSDefine.SystemType), systemType)}"); break; } system.SetGlobalUnionId(GlobalUnionId); system.Execute(entityId, expandData); }while (false); DeleteImmediatelyExecuteSystem(system);//执行完毕回收 }
public void ReceiveCommand(int entityId, ECSDefine.SystemType systemType, BaseSystem.SystemExpandData expandData) { BaseCommand command = PopCommand(systemType); if (command != null) { command.FillIn(entityId, systemType, expandData); cacheCommandList.Add(command); } }
public void RequireCommand(int entityId, ECSDefine.SystemType systemType, BaseSystem.SystemExpandData expandData) { BaseCommand command = PopCommand(systemType); if (command != null) { command.FillIn(entityId, systemType, expandData); sendCommandList.Add(command); ExecuteSystemUnit.ExecuteSystem(entityId, systemType, expandData); } }
public void FillIn(int entityId, ECSDefine.SystemType systemType, BaseSystem.SystemExpandData expandData) { this.entityId = entityId; this.systemType = systemType; this.expandData = expandData; }
public override void UnInit() { entityId = 0; expandData = null; }