public void OnNetworkReceive(NetPeer peer, NetPacketReader reader, DeliveryMethod deliveryMethod) { ControlSystem cs = FindObjectOfType <ControlSystem>(); string req = reader.GetString(); if (req == "Center") { Vector3 pos = Vector3Packet.Deserialize(reader); //pos = Quaternion.AngleAxis(60, Vector3.forward) * pos; pos = new Vector3(pos.x + 12, pos.y, 0); cs.center = pos * 6.5f; } if (req == "PathIncomig") { int lenth = reader.GetInt(); List <Vector3> temp = new List <Vector3>(); for (int i = 0; i < lenth - 1; i++) { Vector3 pos = Vector3Packet.Deserialize(reader); pos = Quaternion.AngleAxis(60, Vector3.forward) * pos; pos = new Vector3(pos.x + 23f, pos.y, 0); temp.Add(pos * 3); } if (cs._wayPoints.Count + lenth < 400) { cs._wayPoints.AddRange(temp); } temp.Clear(); } }
public void OnNetworkReceive(NetPeer peer, NetPacketReader reader, DeliveryMethod deliveryMethod) { string req = reader.GetString(); if (req == "PathIncomig") { for (int i = 0; i < reader.GetInt(); i++) { Vector3 pos = Vector3Packet.Deserialize(reader); GameObject temp = new GameObject(); temp.transform.position = pos; } } }