Esempio n. 1
0
        /// <summary>
        /// Show advised route from player's initial location to spear's landing location.
        /// </summary>
        public static void DrawThrownRoute()
        {
            try
            {
                MapPolyline routeLine = new MapPolyline();
                routeLine.Locations = new LocationCollection();
                routeLine.Color     = Windows.UI.Colors.Red;
                routeLine.Width     = 5.0;

                routeLine.Locations.Add(new Location
                {
                    Latitude  = SatanController.CurrentPlayer.Location.Latitude,
                    Longitude = SatanController.CurrentPlayer.Location.Longitude
                });
                routeLine.Locations.Add(new Location
                {
                    Latitude  = SpearHandler.Gungnir.Location.Latitude,
                    Longitude = SpearHandler.Gungnir.Location.Longitude
                });
                MapShapeLayer shapeLayer = new MapShapeLayer();
                shapeLayer.Shapes.Add(routeLine);
//                Map.ShapeLayers.Add(shapeLayer);
            }
            catch
            {
                //Message dialog, description + Title
                SatanController.ShowMessage("Something went wrong with drawing the route to the spear.", "Error");
            }
        }
Esempio n. 2
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);
        }
Esempio n. 3
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();
                    }
                }
            });
        }