-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSYNC_Listener.cs
31 lines (26 loc) · 1017 Bytes
/
SYNC_Listener.cs
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
using UnityEngine;
public class SYNC_Listener : myUDP
{
public ClientData ownClient;
public SYNC_Listener()
{
myName = "SYNC";
ref_clientList.Find();
}
public override void workFunc(RecvData recvData)
{
trans.position = new Vector2(recvData.RECV_FLOAT(), recvData.RECV_FLOAT());
recvData.m_todo = gogogo;
Debug.Log( " send V2 : " + new Vector2(recvData.RECV_FLOAT(), recvData.RECV_FLOAT()));
}
public Transform trans;
public void gogogo(RecvData recvData)
{
ClientData semiClient = new ClientData(recvData.m_adr, recvData.m_OP, Encoding.Default.GetString(recvData.m_buffer, 4, recvData.m_buffer.Length - 4));
ClientData sender = ref_clientList.Find(x => (x.m_id == recvData.m_OP));
if (sender == null)
return;
Debug.Log(" move V2 : " + new Vector2(recvData.RECV_FLOAT(), recvData.RECV_FLOAT()));
trans.position = new Vector2(recvData.RECV_FLOAT(), recvData.RECV_FLOAT());
}
}