public static void End() { socket.Disconnect(); op = ""; args.Clear(); socket = null; }
void Start() { List <ObstacleInfo> map = new List <ObstacleInfo>(); foreach (GameObject wall in GameObject.FindGameObjectsWithTag("Obstacle")) { ObstacleInfo obs = new ObstacleInfo(); obs.x = wall.transform.position.x; obs.y = wall.transform.position.z; obs.width = wall.transform.localScale.x; obs.length = wall.transform.localScale.z; map.Add(obs); } //Debug.Log(JsonConvert.SerializeObject(map)); Debug.Log("start"); socket = IO.Socket("http://127.0.0.1:5000/"); socket.On(QSocket.EVENT_CONNECT, () => { Debug.Log("Connected"); socket.Emit("generate_new_player", @"{""uid"":0}"); }); socket.On("error", () => { Debug.Log("error disconnect"); socket.Disconnect(); }); socket.On("stub", data => { //Debug.Log("stub data"); //Debug.Log("stub data : " + data); }); socket.On("uid", data => { uidget = JsonConvert.DeserializeObject <UIDAnswer>(data.ToString()); id = uidget.uid; }); socket.On("update", data => { //Debug.Log("update data : " + data); PlayerList list = JsonConvert.DeserializeObject <PlayerList>(data.ToString()); Vector3 pos = new Vector3(); pos.x = list.players[0].x; pos.y = 0.5f; pos.z = list.players[0].y; playerMotor.UpdatePosition(pos); }); }
void OnDestroy() { Debug.Log("disc"); socket.Disconnect(); }
private void OnDestroy() { socket.Disconnect(); }
private void OnApplicationQuit() { socket.Disconnect(); socket.Close(); }
public void Destroy() { Debug.Log("User is disconnecting from socket"); socket.Disconnect(); }