protected override void OnCreate()
        {
            base.OnCreate();

            m_SnapshotManager  = World.GetOrCreateSystem <SnapshotManager>();
            m_DynamicSystemIds = new HashSet <uint>();
        }
コード例 #2
0
        protected override void OnCreate()
        {
            base.OnCreate();

            m_SnapshotManager = World.GetOrCreateSystem <SnapshotManager>();

            GhostToEntityMap = new NativeHashMap <uint, Entity>(64, Allocator.Persistent);

            m_GhostEntityQuery = GetEntityQuery(new EntityQueryDesc
            {
                All = new ComponentType[] { typeof(GhostEntity), typeof(GhostIdentifier) }
            });
            m_GhostWithoutIdentifierQuery = GetEntityQuery(new EntityQueryDesc
            {
                All  = new ComponentType[] { typeof(GhostEntity) },
                None = new ComponentType[] { typeof(GhostIdentifier) }
            });
            m_InvalidGhostQuery = GetEntityQuery(new EntityQueryDesc
            {
                All  = new ComponentType[] { typeof(GhostIdentifier) },
                None = new ComponentType[] { typeof(GhostEntity) }
            });
            m_GhostId = 1;

            m_ChunkToGhostArchetype = new NativeHashMap <ArchetypeChunk, ArchData>(128, Allocator.Persistent);
            m_GhostIdQueue          = new NativeQueue <uint>(Allocator.Persistent);
            m_EntityToChunk         = new Dictionary <Entity, ArchetypeChunk>();

            writer = new DataStreamWriter(24256, Allocator.Persistent);
        }
コード例 #3
0
        public override void SortSystemUpdateList()
        {
            base.SortSystemUpdateList();

            snapshotMgr = World.GetExistingSystem <SnapshotManager>();

            m_DelegateSystems.Clear();
            m_OnDeserializeList.Clear();
            m_OnSerializeList.Clear();
            foreach (var sys in Systems)
            {
                if (sys is ISystemDelegateForSnapshot castSys)
                {
                    m_DelegateSystems.Add(castSys);
                    m_OnDeserializeList.Add(new SortDelegate <OnDeserializeSnapshot>
                    {
                        Name     = castSys.NativeName,
                        SystemId = snapshotMgr.GetSystemId(sys),
                        Value    = castSys.DeserializeDelegate
                    });
                    m_OnSerializeList.Add(new SortDelegate <OnSerializeSnapshot>
                    {
                        Name     = castSys.NativeName,
                        SystemId = snapshotMgr.GetSystemId(sys),
                        Value    = castSys.SerializeDelegate
                    });
                }
            }
            m_OnDeserializeList.Sort();
            m_OnSerializeList.Sort();
        }