void OnBallPosMessage(NetworkMessage msg) { BallPos pos = msg.ReadMessage <BallPos>(); ballPos.x = pos.px; ballPos.y = pos.py; RpcSetBallProperties(pos.id, pos.px, pos.py, pos.vx, pos.vy); }
public static void SendBallPos(float px, float py, float vx, float vy) { if (client == null) { return; } BallPos msg = new BallPos(); msg.id = connId; msg.px = px; msg.py = py; msg.vx = vx; msg.vy = vy; client.Send(PongMsgType.BallPos, msg); }
// Start is called before the first frame update void Start() { gameSession = FindObjectOfType <GameSession>(); ball = FindObjectOfType <BallPos>(); }