/** * This process is executed each 10 seconds. First, the location of the device is updated, * after that, we obtain the map. Later, the go through the locations and we configure the * UI depending if we have a location to show or a near location. */ private IEnumerator refreshLocation() { while (true) { UnityEngine.Debug.Log("Refreshing location of the device."); var coordactual = new Location(GPS.Instance.latitude, GPS.Instance.longitude, 0); StartCoroutine("obtainMap"); foreach (Location l in locations) { var distance = CoordinatesDistanceExtensions.DistanceTo(l, coordactual); if (distance < 20 && actualRep == null) // less 20 meters show { UnityEngine.Debug.Log("Location detected at " + distance + " meters."); obtainAllInfo(l.id); obtainRepVideo(l.id); obtainRepImage(l.id); isShowing = true; } else if (distance < 200) // less 200 meters show as near location { UnityEngine.Debug.Log("Near location detected at " + distance + " meters."); obtainLocationImage(l); nearLocations.Add(l); l.distance = distance; } else if (!isShowing) { actualRep = null; } } configureNearLocations(); if (actualRep == null) { panelShow.SetActive(false); } else { configureUI(); } yield return(new WaitForSeconds(10.0f)); //Wait 10 seconds } }
public async Task <IEnumerable <Band> > BandsInDistance(Coordinates coordinates, double distance) { return(await _context.Bands.Where(x => CoordinatesDistanceExtensions.DistanceTo(coordinates, new Coordinates(x.Latitude, x.Longitude)) < distance).ToListAsync()); }
public IEnumerable <UserAccount> UsersInDistance(Coordinates coordinates, double distance) { return(_context.UserAccounts.Where(x => CoordinatesDistanceExtensions.DistanceTo(coordinates, new Coordinates(x.Latitude, x.Longitude)) < distance)); }