Exemplo n.º 1
0
        /// <summary>
        /// Draws the walkable route to the spear, if the spear is unavailable
        /// </summary>
        public async void DrawWalkableRouteToSpear(Location playerLocation, Location spearLocation)
        {
            if (DirManager == null)
            {
                DirManager = Map.DirectionsManager;
            }
            DirManager.Waypoints.Clear();

            DirManager.Waypoints.Add(new Waypoint(playerLocation));
            DirManager.Waypoints.Add(new Waypoint(spearLocation));


            DirManager.RequestOptions.RouteMode = RouteModeOption.Walking;
            DirManager.RequestOptions.Optimize  = OptimizeOption.Walking;

            //Do something with the distance

            RouteResponse response = await DirManager.CalculateDirectionsAsync();

            // not sure if merge conflict or not
            DirManager.RenderOptions.WaypointPushpinOptions.Visible = false;


            SpearHandler.Score.Distance = response.Routes[0].TravelDistance * 1000;
            SpearHandler.PropertyChanged(); //Manual f*** you to binding.

            if (response.HasError)
            {
                await SatanController.ShowMessageAsync("Route error", "The route could not be calculated.");
            }
            DirManager.ShowRoutePath(DirManager.ActiveRoute);
        }