/// <inheritdoc />
        public void AddComponent(AddComponentPipelineOp addComponentOp)
        {
            var entityId = addComponentOp.EntityId;

            if (IsEntityQueued(entityId))
            {
                entityActions[entityId].Enqueue(addComponentOp);
            }
            else
            {
                NextEntityBlock.AddComponent(addComponentOp);
            }
        }
        /// <inheritdoc />
        public override void AddComponent(AddComponentPipelineOp addComponentOp)
        {
            var entityId = addComponentOp.EntityId;

            if (!universe.ContainsEntity(entityId))
            {
                Debug.LogError("EntityComponentUpdater::AddComponent: Entity not present: " + entityId);
                return;
            }

            var entity = universe.Get(entityId);

            entity.OnAddComponentPipelineOp(addComponentOp);
            NextEntityBlock.AddComponent(addComponentOp);
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        public override void AddComponent(AddComponentPipelineOp addComponentOp)
        {
            var entity = universe.Get(addComponentOp.EntityId);

            if (entity != null)
            {
                if (entity.Visualizers is EntityVisualizers)
                {
                    ((EntityVisualizers)entity.Visualizers).OnComponentAdded(addComponentOp.ComponentMetaClass, addComponentOp.ComponentObject);
                }
            }
            else
            {
                Debug.LogErrorFormat("Entity not found: OnComponentAdded({0}, {1})", addComponentOp.EntityId, addComponentOp.ComponentMetaClass);
            }

            NextEntityBlock.AddComponent(addComponentOp);
        }
        /// <inheritdoc />
        public void AddComponent(AddComponentPipelineOp addComponentOp)
        {
            if (!IsEntityTracked(addComponentOp.EntityId))
            {
                Debug.LogErrorFormat("Entity not found: OnComponentAdded({0}, {1})", addComponentOp.EntityId,
                                     addComponentOp.ComponentMetaClass);
                return;
            }

            if (universe.ContainsEntity(addComponentOp.EntityId))
            {
                NextEntityBlock.AddComponent(addComponentOp);
                return;
            }

            if (entitiesToSpawn.ContainsKey(addComponentOp.EntityId))
            {
                var entityData = entitiesToSpawn[addComponentOp.EntityId];

                entityData.StalledOps.Enqueue(addComponentOp);

                if (addComponentOp.ComponentMetaClass.ComponentId == Position.ComponentId)
                {
                    entityData.Position = ((Position.Impl)addComponentOp.ComponentObject).Data;
                    if (entityData.EntityType != null)
                    {
                        MakeEntity(addComponentOp.EntityId, entityData.EntityType, OnMakeEntitySuccess);
                    }
                }
                else if (addComponentOp.ComponentMetaClass.ComponentId == Metadata.ComponentId)
                {
                    entityData.EntityType = ((Metadata.Impl)addComponentOp.ComponentObject).Data.entityType;
                    if (entityData.Position.HasValue)
                    {
                        MakeEntity(addComponentOp.EntityId, entityData.EntityType, OnMakeEntitySuccess);
                    }
                }
            }
        }
Exemplo n.º 5
0
 /// <inheritdoc />
 public void AddComponent(AddComponentPipelineOp addComponentOp)
 {
     StallForCriticalSection(addComponentOp);
 }