Exemple #1
0
        public void SetName(Entity entity, string name)
        {
            switch (Type)
            {
            case EntityManagerType.ENTITY_MANAGER:
#if UNITY_EDITOR
                EntityManager.SetName(entity, name);
#else
                EntityManager.AddComponentData(entity, new SetName {
                    Value = new FixedString64(name)
                });
#endif
                return;

            case EntityManagerType.ENTITY_COMMAND_BUFFER:
            case EntityManagerType.ENTITY_MANAGER_AND_COMMAND_BUFFER:
                EntityCommandBuffer.AddComponent(entity, new SetName {
                    Value = new FixedString64(name)
                });
                return;

            case EntityManagerType.ENTITY_COMMAND_BUFFER_CONCURRENT:
                EntityCommandBufferConcurrent.AddComponent(EntityCommandBufferJobIndex, entity, new SetName {
                    Value = new FixedString64(name)
                });
                return;
            }

            throw new NotImplementedException();
        }
Exemple #2
0
        public void AddComponent <T>(Entity entity) where T : struct, IComponentData
        {
            switch (Type)
            {
            case EntityManagerType.ENTITY_MANAGER:
                EntityManager.AddComponent <T>(entity);
                return;

            case EntityManagerType.ENTITY_COMMAND_BUFFER:
                EntityCommandBuffer.AddComponent <T>(entity);
                return;

            case EntityManagerType.ENTITY_COMMAND_BUFFER_CONCURRENT:
                EntityCommandBufferConcurrent.AddComponent <T>(EntityCommandBufferJobIndex, entity);
                return;
            }

            throw new NotImplementedException();
        }