/// <summary> Send with this method if event occured and position changed /// /// </summary> /// <param name="position">player new position</param> /// <param name="lookDirection">player new looking/aiming direction</param> /// <param name="moventDirection">player new movement vector</param> /// <param name="weaponAttacked"> weapon that was used to atack</param> /// <param name="playerAttacked"> true if player used his weapon </param> /// <param name="playerJumped">true if player jumped</param> /// <param name="weaponChanged"> true if weapon changed</param> /// <param name="weaponNew"> new weapon carried by the player</param> public void UpdatePlayerData(Microsoft.DirectX.Vector3 position, Microsoft.DirectX.Vector3 lookDirection, Microsoft.DirectX.Vector3 moventDirection, WeaponEnumeration weaponAttacked, bool playerAttacked, bool playerJumped, bool weaponChanged, WeaponEnumeration weaponNew) { lock (clientPacketLock) { try { clientPacket.TimeStamp = DateTime.Now; clientPacket.PlayerPosition = Translator.TranslateBetweenVectorAndVector(position); clientPacket.PlayerLookingDirection = Translator.TranslateBetweenVectorAndVector(lookDirection); clientPacket.PlayerMovementDirection = Translator.TranslateBetweenVectorAndVector(moventDirection); } catch (Exception ex) { Diagnostic.NetworkingDiagnostics.Logging.Error("Update player data S", ex); } } }
/// <summary> Send with this method if important event occured /// /// </summary> /// <param name="weaponAttacked"> weapon that was used to atack</param> /// <param name="playerAttacked"> true if player used his weapon </param> /// <param name="playerJumped">true if player jumped</param> /// <param name="weaponChanged"> true if weapon changed</param> /// <param name="weaponNew"> new weapon carried by the player</param> public void UpdatePlayerData(WeaponEnumeration weaponAttacked, bool playerAttacked, bool playerJumped, bool weaponChanged, WeaponEnumeration weaponNew) { lock (clientPacketLock) { try { clientPacket.TimeStamp = DateTime.Now; clientPacket.PlayerShooting = playerAttacked; clientPacket.PlayerJumping = playerJumped; if (playerAttacked) if (weaponAttacked == WeaponEnumeration.CrossBow) { clientPacket.PlayerCarringWeponOne = false; clientPacket.PlayerCarringWeponTwo = true; } else { clientPacket.PlayerCarringWeponTwo = false; clientPacket.PlayerCarringWeponOne = true; } else if (weaponChanged) { if (weaponNew == WeaponEnumeration.CrossBow) { clientPacket.PlayerCarringWeponOne = false; clientPacket.PlayerCarringWeponTwo = true; } else { clientPacket.PlayerCarringWeponTwo = false; clientPacket.PlayerCarringWeponOne = true; } } } catch (Exception ex) { Diagnostic.NetworkingDiagnostics.Logging.Error("Update player data S", ex); } } }