Beispiel #1
0
 protected override void OnCreateManager()
 {
     m_BeginEntityCommandBufferSystem = World.GetOrCreateManager <BeginSimulationEntityCommandBufferSystem>();
     m_lateSimulationGroup            = World.GetOrCreateManager <LateSimulationSystemGroup>();
     m_EndEntityCommandBufferSystem   = World.GetOrCreateManager <EndSimulationEntityCommandBufferSystem>();
     m_systemsToUpdate.Add(m_BeginEntityCommandBufferSystem);
     m_systemsToUpdate.Add(m_lateSimulationGroup);
     m_systemsToUpdate.Add(m_EndEntityCommandBufferSystem);
 }
Beispiel #2
0
        public override void SortSystemUpdateList()
        {
            // Extract list of systems to sort (excluding built-in systems that are inserted at fixed points)
            var toSort = new List <ComponentSystemBase>(m_systemsToUpdate.Count);
            BeginSimulationEntityCommandBufferSystem beginEcbSys = null;
            LateSimulationSystemGroup lateSysGroup           = null;
            EndSimulationEntityCommandBufferSystem endEcbSys = null;

            foreach (var s in m_systemsToUpdate)
            {
                if (s is BeginSimulationEntityCommandBufferSystem)
                {
                    beginEcbSys = (BeginSimulationEntityCommandBufferSystem)s;
                }
                else if (s is LateSimulationSystemGroup)
                {
                    lateSysGroup = (LateSimulationSystemGroup)s;
                    lateSysGroup.SortSystemUpdateList(); // not handled by base-class sort call below
                }
                else if (s is EndSimulationEntityCommandBufferSystem)
                {
                    endEcbSys = (EndSimulationEntityCommandBufferSystem)s;
                }
                else
                {
                    toSort.Add(s);
                }
            }
            m_systemsToUpdate = toSort;
            base.SortSystemUpdateList();
            // Re-insert built-in systems to construct the final list
            var finalSystemList = new List <ComponentSystemBase>(toSort.Count);

            if (beginEcbSys != null)
            {
                finalSystemList.Add(beginEcbSys);
            }
            foreach (var s in m_systemsToUpdate)
            {
                finalSystemList.Add(s);
            }
            if (lateSysGroup != null)
            {
                finalSystemList.Add(lateSysGroup);
            }
            if (endEcbSys != null)
            {
                finalSystemList.Add(endEcbSys);
            }
            m_systemsToUpdate = finalSystemList;
        }