Esempio n. 1
0
        public void FlushBuffer(MutableView view)
        {
            foreach (var bufferedCommand in bufferedCommands)
            {
                switch (bufferedCommand.CommandType)
                {
                case CommandType.AddComponent:
                    view.SetComponentObject(bufferedCommand.Entity,
                                            bufferedCommand.ComponentType,
                                            bufferedCommand.ComponentObj);
                    break;

                case CommandType.RemoveComponent:
                    view.RemoveComponent(bufferedCommand.Entity,
                                         bufferedCommand.ComponentType);
                    break;

                default:
                    view.LogDispatcher.HandleLog(LogType.Error, new LogEvent(UnknownErrorEncountered)
                                                 .WithField(LoggingUtils.LoggerName, LoggerName)
                                                 .WithField("CommandType", bufferedCommand.CommandType));
                    break;
                }
            }

            bufferedCommands.Clear();
        }
        protected override void OnCreateManager(int capacity)
        {
            base.OnCreateManager(capacity);

            worker = WorkerRegistry.GetWorkerForWorld(World);
            view   = worker.View;

            GenerateComponentGroups();
        }
Esempio n. 3
0
        protected override void OnCreateManager(int capacity)
        {
            base.OnCreateManager(capacity);

            worker = WorkerRegistry.GetWorkerForWorld(World);
            view   = worker.View;

            dispatcher = new Dispatcher();
            SetupDispatcherHandlers();
        }
Esempio n. 4
0
        protected WorkerBase(string workerId, Vector3 origin, ILogDispatcher loggingDispatcher)
        {
            if (string.IsNullOrEmpty(workerId))
            {
                throw new ArgumentException("WorkerId is null or empty.", nameof(workerId));
            }

            WorkerId = workerId;
            World    = new World(WorkerId);
            WorkerRegistry.SetWorkerForWorld(this);

            View   = new MutableView(World, loggingDispatcher);
            Origin = origin;

            EntityGameObjectLinker = new EntityGameObjectLinker(World, View);
        }
Esempio n. 5
0
        protected WorkerBase(string workerId, Vector3 origin, ILogDispatcher loggingDispatcher)
        {
            if (string.IsNullOrEmpty(workerId))
            {
                WorkerId = GenerateDynamicWorkerId();

                UseDynamicId = true;
            }
            else
            {
                WorkerId = workerId;
            }

            World = new World(WorkerId);
            WorkerRegistry.SetWorkerForWorld(this);

            View   = new MutableView(World, loggingDispatcher);
            Origin = origin;

            EntityGameObjectLinker = new EntityGameObjectLinker(World, View);
        }
 public EntityGameObjectLinker(World world, MutableView view)
 {
     this.world = world;
     this.view  = view;
 }
Esempio n. 7
0
 public WorldCommandsTranslation(MutableView view) : base(view)
 {
 }