示例#1
0
        private void Update()
        {
            serverTick++;

            PlayerState state = character.State;

            if (inputBuffer.Count != 0)
            {
                lastInputs = inputBuffer.Dequeue();
            }

            state = character.Move(state, lastInputs, serverTick);
            character.SyncState(state);

            state.Position  = transform.position;
            character.State = state;
            character.OnServerStateChange(state, state);
        }
 public void AddInput(PlayerInputs input)
 {
     pendingInputs.AddLast(input);
     ApplyInput(input);
     character.SyncState(predictedState);
 }
 private void SetObservedState(PlayerState newState)
 {
     character.SyncState(newState);
 }