示例#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);
        }
示例#2
0
        /// <summary>
        /// Protocol on reaching Gungnir
        /// </summary>
        private async void Current_GeofenceStateChanged(GeofenceMonitor sender, object e)
        {
            System.Diagnostics.Debug.WriteLine("Entered geofence");
            var reports = sender.ReadReports();
            await MainPage.dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
            {
                foreach (var item in reports)
                {
                    var state = item.NewState;

                    if (state == GeofenceState.Entered)
                    {
                        SpearHandler.EndTimeRecord();
                        await SatanController.ShowMessageAsync("Gungnir", "You have retrieved Gungnir!");
                        ClearRoute();
                        SpearHandler.EndThrow();
                    }
                }
            });
        }