Esempio n. 1
0
    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);//执行完毕回收
    }
Esempio n. 2
0
    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);
        }
    }
Esempio n. 3
0
    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);
        }
    }
Esempio n. 4
0
 public void FillIn(int entityId, ECSDefine.SystemType systemType, BaseSystem.SystemExpandData expandData)
 {
     this.entityId   = entityId;
     this.systemType = systemType;
     this.expandData = expandData;
 }
Esempio n. 5
0
 public override void UnInit()
 {
     entityId   = 0;
     expandData = null;
 }