Exemple #1
0
    // Enable the closest waypoint if it is within it's radius of the current location
    void EnableWaypointWithinRange()
    {
        var oldClosest = closest;
        var current    = locationManager.Current();

//        closest      = waypoints.Closest(current);
        closest = waypoints.FirstEnabled();
        var isWithin = closest ? closest.location.WithinRadius(current, closest.radius) : false;
        var distance = closest.location.Distance(current);

        if (debugText)
        {
            debugText.text = closest + ", " + Math.Ceiling(distance).ToString();
        }
        if (isWithin)
        {
            closest.Enabled = true;
            // source.PlayOneShot(soundToPlay);
            // Handheld.Vibrate();
        }
    }