public void BeginTimestamp(Timestamp ts) { // For each neighboring node (connected) for (int i = 0; i < Connections.Count; ++i) { var conn = Connections[i]; if (!conn.Touch) { // Disconnect if it's no longer in range. ts.NumberOfDisconnections += 1; ts.NumberOfDisconnectionMessages += Algorithm.RemoveVehicleFromGroupView(this, conn); Connections.RemoveAt(i--); } else if (conn.IsNew) { // It's a new connection. Add it to the group. ts.NumberOfNewConnections += 1; ts.NumberOfConnectionMessages += Algorithm.AddVehicleToGroupView(this, conn); conn.IsNew = false; } } }