微信登录

游戏互交1 - 双客SyncPositionRequest-发送自身pos

作用:发送自身位置

  1. SyncPositionRequest.cs
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Common;
  5. //同步方向
  6. public class SyncPositionRequest :Request {
  7. [HideInInspector]
  8. public Vector3 pos;//位置
  9. public override void DefaultRequest()
  10. {
  11. Dictionary<byte, object> data = new Dictionary<byte, object>();
  12. //data.Add((byte)ParameterCode.Position, new Vector3Data() { x=pos.x,y=pos.y,z = pos.z});
  13. data.Add((byte)ParameterCode.X, pos.x);
  14. data.Add((byte)ParameterCode.Y, pos.y);
  15. data.Add((byte)ParameterCode.Z, pos.z);
  16. PhotonEngine.Peer.OpCustom((byte)OpCode, data, true);//发起请求
  17. }
  18. public override void OnOperationResponse(ExitGames.Client.Photon.OperationResponse operationResponse)
  19. {
  20. throw new System.NotImplementedException();
  21. }
  22. }