コード例 #1
0
        private void ProcessInputQueue(ServerFrame frame)
        {
            var inputs = frame.Inputs;

            foreach (var playerInput in _playerInputs)
            {
                playerInput.Reset();
            }

            foreach (var input in inputs)
            {
                if (input.Commands == null)
                {
                    continue;
                }
                if (input.ActorId >= _playerInputs.Length)
                {
                    continue;
                }
                var inputEntity = _playerInputs[input.ActorId];
                foreach (var command in input.Commands)
                {
                    Logger.Trace(this, input.ActorId + " >> " + input.Tick + ": " + input.Commands.Count());
                    _inputService.Execute(command, inputEntity);
                }
            }
        }
コード例 #2
0
        private void ProcessInputQueue(ServerFrame frame)
        {
            var inputs = frame.Inputs;

            foreach (var input in inputs)
            {
                GameLog.Add(frame.tick, input);
                if (input.Commands == null)
                {
                    continue;
                }
                foreach (var command in input.Commands)
                {
                    Logger.Trace(this, input.ActorId + " >> " + input.Tick + ": " + input.Commands.Count());
                    var inputEntity = _context.input.CreateEntity();
                    _inputService.Execute(command, inputEntity);
                    inputEntity.AddTick(input.Tick);
                    inputEntity.AddActorId(input.ActorId);
                    inputEntity.isDestroyed = true;
                }
            }
        }