private void InvokeOnAuthorityChangedCallbacks(ChangeAuthorityPipelineOp op)
 {
     for (var i = 0; i < changeReceivers.Count; i++)
     {
         changeReceivers[i].AuthorityChanged(op.EntityId, op.ComponentMetaClass, op.Authority, op.ComponentObject);
     }
 }
        /// <inheritdoc />
        public void ChangeAuthority(ChangeAuthorityPipelineOp changeAuthorityOp)
        {
            var entityId = changeAuthorityOp.EntityId;

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

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

            var entity = universe.Get(entityId);

            entity.OnAuthorityChangePipelineOp(changeAuthorityOp);
            NextEntityBlock.ChangeAuthority(changeAuthorityOp);
        }
        /// <inheritdoc />
        public override void ChangeAuthority(ChangeAuthorityPipelineOp op)
        {
            var entity = localEntities.Get(op.EntityId);

            if (entity != null)
            {
                var visualizers = entity.Visualizers as EntityVisualizers;
                if (visualizers != null)
                {
                    visualizers.OnAuthorityChanged(op.ComponentMetaClass, op.Authority, op.ComponentObject);
                    InvokeOnAuthorityChangedCallbacks(op);
                }
            }
            else
            {
                Debug.LogErrorFormat("Entity not found: OnAuthorityChanged({0}, {1}, {2})", op.EntityId, op.ComponentMetaClass, op.Authority);
            }
        }
        /// <inheritdoc />
        public void ChangeAuthority(ChangeAuthorityPipelineOp changeAuthorityOp)
        {
            if (!IsEntityTracked(changeAuthorityOp.EntityId))
            {
                Debug.LogErrorFormat("Entity not found: OnAuthorityChanged({0}, {1}) authority: {2}",
                                     changeAuthorityOp.EntityId, changeAuthorityOp.ComponentMetaClass, changeAuthorityOp.Authority);
                return;
            }

            if (universe.ContainsEntity(changeAuthorityOp.EntityId))
            {
                NextEntityBlock.ChangeAuthority(changeAuthorityOp);
                return;
            }

            if (entitiesToSpawn.ContainsKey(changeAuthorityOp.EntityId))
            {
                entitiesToSpawn[changeAuthorityOp.EntityId].StalledOps.Enqueue(changeAuthorityOp);
            }
        }
Exemple #6
0
 /// <inheritdoc />
 public void ChangeAuthority(ChangeAuthorityPipelineOp changeAuthorityOp)
 {
     StallForCriticalSection(changeAuthorityOp);
 }
Exemple #7
0
 /// <inheritdoc />
 public override void ChangeAuthority(ChangeAuthorityPipelineOp changeAuthorityOp)
 {
     NextEntityBlock.ChangeAuthority(changeAuthorityOp);
 }