public override IEnumerator ReceivePayload(VisualPayload payload) { if (DataShare == null) { DataShare = new NodeDataShare <Socket>(); } var IPs = Dns.GetHostAddresses(TargetAddress.GetFirstValue(payload.Data)); var newSocket = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { newSocket.Connect(IPs.First(), TargetPort.GetFirstValue(payload.Data)); DataShare[GroupId.GetFirstValue(payload.Data)] = newSocket; } catch (Exception e) { Debug.LogError("Could not connect to socket! Error: " + e); } yield break; }
protected override MutableObject Mutate(MutableObject mutable) { if (DataShare == null) { DataShare = new NodeDataShare <Dictionary <int, Vector3> >(); } var groupId = GroupId.GetFirstValue(mutable); if (!DataShare.ContainsKey(groupId)) { DataShare[groupId] = new Dictionary <int, Vector3>(); } var vectors = DataShare[groupId]; //var vectors = new Dictionary<int, Vector3>(); foreach (var subEntry in EntryPosition.GetEntries(mutable)) { var index = EntryIndex.GetValue(subEntry); var position = EntryPosition.GetValue(subEntry); vectors[index] = position; } return(mutable); }