void HandleMovement() { PlayerMovePackage.Direction dir = PlayerMovePackage.Direction.Stop; if (Input.GetKey(Options.Controls.Forward)) { dir = dir.Add(PlayerMovePackage.Direction.Up); } if (Input.GetKey(Options.Controls.Backward)) { dir = dir.Add(PlayerMovePackage.Direction.Back); } if (Input.GetKey(Options.Controls.StrafeLeft)) { dir = dir.Add(PlayerMovePackage.Direction.Left); } if (Input.GetKey(Options.Controls.StrafeRight)) { dir = dir.Add(PlayerMovePackage.Direction.Right); } if (currentDirection != dir) { PlayerMovePackage pmp = new PlayerMovePackage(transform.root.position, transform.root.rotation.eulerAngles, dir); NetworkManager.Instance.Client.SendData(pmp); //print("Changed: " + dir); } currentDirection = dir; }
void HandleMovement() { PlayerMovePackage.Direction dir = PlayerMovePackage.Direction.Stop; if (Input.GetKey(Options.Controls.Forward)) dir = dir.Add(PlayerMovePackage.Direction.Up); if (Input.GetKey(Options.Controls.Backward)) dir = dir.Add(PlayerMovePackage.Direction.Back); if (Input.GetKey(Options.Controls.StrafeLeft)) dir = dir.Add(PlayerMovePackage.Direction.Left); if (Input.GetKey(Options.Controls.StrafeRight)) dir = dir.Add(PlayerMovePackage.Direction.Right); if (currentDirection != dir) { PlayerMovePackage pmp = new PlayerMovePackage(transform.root.position, transform.root.rotation.eulerAngles, dir); NetworkManager.Instance.Client.SendData(pmp); //print("Changed: " + dir); } currentDirection = dir; }