private void SendPendingAction() { if (_isDedicateServer) { return; } Action action = null; if (_actionsToSend.Count > 0) { action = _actionsToSend.Dequeue(); } //if no action for this turn, send the NoAction action if (action == null) { action = new NoAction(); } //action.networkLagTime = Network.GetLastPing (Network.connections[0/*host player*/]); if (_lockStepTurnID > firstLockStepTurnID + 1) { action.networkLagTime = _confirmedActions.GetPriorTime(); } else { action.networkLagTime = _initialLockStepTurnLength; } action.gameLagTime = Convert.ToInt32(_currentGameFrameRuntime); //clear the current runtime average _currentGameFrameRuntime = 0; //add action to our own list of actions to process // _pendingActions.AddAction(action, Convert.ToInt32(_localPlayerIndex), _lockStepTurnID, _lockStepTurnID); //start the confirmed action timer for network average _confirmedActions.StartTimer(); //confirm our own action _confirmedActions.ConfirmAction(_localPlayerIndex, _lockStepTurnID, _lockStepTurnID); // _confirmedActions.AddCurrentConfirmed(Network.player); //send action to all other players _networkInterface.CallSendAction(_lockStepTurnID, _localPlayerIndex, BinarySerialization.SerializeObjectToByteArray(action)); // Debug.Log("Sent " + (action.GetType().Name) + " action for turn " + _lockStepTurnID); }