public OtherPlayerState UpdateState(float progression, OtherPlayerState target) { return(new OtherPlayerState( Vector3.Lerp(Position, target.Position, progression), target.Rotation )); }
protected override OtherPlayersStates DeserializeData(byte[] bytes) { lock (this) { Dictionary <int, OtherPlayerState> actions; float timeStamp; try { buffer.LoadBytes(bytes); buffer.ToRead(); timeStamp = buffer.ReadFloat(_timeStampMin, _timeStampMax, _timeStampPrecision); var amount = buffer.ReadInt(_minPlayers, _maxPlayers); actions = new Dictionary <int, OtherPlayerState>(amount); for (int i = 0; i < amount; i++) { var player = buffer.ReadInt(_minPlayers, _maxPlayers); var posX = buffer.ReadFloat(_positionMin, _positionMax, _positionPrecision); var posY = buffer.ReadFloat(_positionMin, _positionMax, _positionPrecision); var posZ = buffer.ReadFloat(_positionMin, _positionMax, _positionPrecision); var rotX = buffer.ReadFloat(_minRot, _maxRot, _stepRot); var rotY = buffer.ReadFloat(_minRot, _maxRot, _stepRot); var rotZ = buffer.ReadFloat(_minRot, _maxRot, _stepRot); actions[player] = new OtherPlayerState( new Vector3(posX, posY, posZ), Quaternion.Euler(rotX, rotY, rotZ) ); } } catch (Exception e) { Debug.LogError(e); throw; } return(new OtherPlayersStates(timeStamp, actions)); } }