/// <summary>
    /// Checks the Bounds of loaded areas and removes the corresponding error image if it is in the
    /// same place.
    /// </summary>
    /// <param name="args">
    /// The <see cref="MapLoadProgressArgs"/> from the <see cref="MapEvents.Progress"/> event.
    /// </param>
    private void OnMapLoadProgress(MapLoadProgressArgs args)
    {
        var imagesToRemove = new List <LinkedListNode <GameObject> >();

        foreach (Bounds bounds in args.GetBounds(MapsService.Coords))
        {
            LinkedListNode <GameObject> node = ErrorImages.First;
            while (node != null)
            {
                GameObject errorImage = node.Value;
                if (bounds.Contains(errorImage.transform.position))
                {
                    // If the area that successfully loaded contains an error image, mark it for removal.
                    imagesToRemove.Add(node);
                }
                node = node.Next;
            }
        }

        // Actually destroy and remove the marked error images.
        foreach (LinkedListNode <GameObject> toRemove in imagesToRemove)
        {
            Destroy(toRemove.Value);
            ErrorImages.Remove(toRemove);
        }

        // Ensure the FloatingOriginUpdater knows about all the error images so they can be
        // repositioned if necessary.
        GetComponent <FloatingOriginUpdater>().SetAdditionalGameObjects(ErrorImages);
    }
Beispiel #2
0
 /// <summary>
 /// Updates the loading bar image based on the progress from a
 /// <see cref="Google.Maps.Event.MapEvents.Progress"/> event.
 /// </summary>
 /// <param name="args"><see cref="Google.Maps.Event.MapEvents.Progress"/></param>
 private void OnMapLoadProgress(MapLoadProgressArgs args)
 {
     if (args.Progress < 1.0f)
     {
         // If progress is less than 100%, fill the appropriate amount of the image.
         FillImage.fillAmount = args.Progress;
         Loading = true;
     }
     else if (Loading)
     {
         // If loading has finished, hide the loading bar.
         FillImage.fillAmount = 1.0f;
         StartCoroutine(HideLoadingBar());
         Loading = false;
     }
 }
Beispiel #3
0
 /// <summary>
 /// Updates the loading bar image based on the progress from a
 /// <see cref="Google.Maps.Event.MapEvents.Progress"/> event.
 /// </summary>
 /// <param name="args"><see cref="Google.Maps.Event.MapEvents.Progress"/>.</param>
 void OnMapLoadProgress(MapLoadProgressArgs args)
 {
     ShowProgressBar(args.Progress);
 }