Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.cs
More file actions
Latest commit
37 lines (30 loc) · 940 Bytes
/
Copy pathcontroller.cs
File metadata and controls
37 lines (30 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
usingUnityEngine;
usingSystem.Collections;
usingSystem.Collections.Generic;
usingSocketIO;
publicclasscontroller:MonoBehaviour{
privateGameObjectplayer;
stringgamedata="";
voidStart(){
GameObjectgo=GameObject.Find("SocketIO");
player=GameObject.Find("player");
SocketIOComponentsocket=go.GetComponent<SocketIOComponent>();
socket.On("datarec",(SocketIOEventobj)=>{
//Debug.Log(obj.data);
Debug.Log(obj.data.ToString().Substring(9,3));
gamedata=obj.data.ToString().Substring(9,3);
player.transform.Rotate(0,float.Parse(gamedata),0);
});
}
// Update is called once per frame
voidUpdate(){
}
voidOnGUI(){
if(GUI.Button(newRect(10,70,50,30),"Click")){
Debug.Log("Clicked the button with text");
GameObjectgo=GameObject.Find("SocketIO");
SocketIOComponentsocket=go.GetComponent<SocketIOComponent>();
//socket.Emit ("disconnect");
}
}
}