Ejemplo n.º 1
0
        /// <inheritdoc />
        public void AddEntity(AddEntityPipelineOp addEntityOp)
        {
            if (!inCriticalSection)
            {
                Debug.LogErrorFormat("CriticalSectionPipelineBlock received AddEntityPipelineOp for entity {0} outside of critical section", addEntityOp.EntityId);
                return;
            }

            criticalSectionEntityOps.Enqueue(addEntityOp);
        }
 /// <inheritdoc />
 public void AddEntity(AddEntityPipelineOp addEntityOp)
 {
     if (!IsEntityTracked(addEntityOp.EntityId))
     {
         knownEntities.Add(addEntityOp.EntityId);
         var spawnData = new EntitySpawnData();
         entitiesToSpawn.Add(addEntityOp.EntityId, spawnData);
         spawnData.StalledOps.Enqueue(addEntityOp);
         metrics.IncrementGauge(EntityCountGaugeName);
     }
     else
     {
         Debug.LogErrorFormat("Trying to add the entity '{0}' that already exists.", addEntityOp.EntityId);
     }
 }
        /// <inheritdoc />
        public void AddEntity(AddEntityPipelineOp addEntityOp)
        {
            if (spawnLimiter.CanSpawnEntity() && !IsEntityQueued(addEntityOp.EntityId))
            {
                NextEntityBlock.AddEntity(addEntityOp);
                spawnLimiter.EntityAdded(addEntityOp.EntityId);
            }
            else
            {
                Queue <IEntityPipelineOp> queue;
                if (!entityActions.TryGetValue(addEntityOp.EntityId, out queue))
                {
                    queue = entityActions[addEntityOp.EntityId] = new Queue <IEntityPipelineOp>();
                    workerMetrics.IncrementGauge(QueueSizeMetricName);
                    entitiesToAdd.Enqueue(addEntityOp.EntityId);
                }

                queue.Enqueue(addEntityOp);
            }
        }