Test de communication de paquets entre un client et un serveur
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class PlayerController : MonoBehaviour
  5. {
  6. public Transform camTransform;
  7. private void Update()
  8. {
  9. if (Input.GetKeyDown(KeyCode.Mouse0))
  10. {
  11. ClientSend.PlayerShoot(camTransform.forward);
  12. }
  13. }
  14. private void FixedUpdate()
  15. {
  16. SendInputToServer();
  17. }
  18. private void SendInputToServer()
  19. {
  20. bool[] _inputs = new bool[]
  21. {
  22. Input.GetKey(KeyCode.Z),
  23. Input.GetKey(KeyCode.S),
  24. Input.GetKey(KeyCode.Q),
  25. Input.GetKey(KeyCode.D),
  26. Input.GetKey(KeyCode.Space)
  27. };
  28. ClientSend.PlayerMovement(_inputs);
  29. }
  30. }