Ejemplo n.º 1
0
        public SlamVisualizer(Game game, SpriteRenderer renderer, SlamController controller, NavigationEnvironment environment)
        {
            font = game.Content.Load <SpriteFont>("DebugFont");
            var textureColor = new Color(255, 255, 255, 100);
            var strokeColor  = new Color(0, 0, 0, 100);

            covarianceTexture = TextureFactory.CreateCircleTexture(game.GraphicsDevice, 1000, 20, 5, 5, textureColor, strokeColor);
            elements          = new List <SlamElement>();
            this.controller   = controller;
            this.renderer     = renderer;
            this.environment  = environment;
        }
Ejemplo n.º 2
0
        static void ActivateMarker(ActionPlayer player, Vehicle vehicle, NavigationEnvironment environment, SlamController slam, SmartObject landmark, IServiceProvider provider)
        {
            var task = landmark.Task;

            if (task == null)
            {
                return;
            }

            var markerPosition = slam.GetLandmarkPosition(landmark.MarkerId);

            if (markerPosition == null)
            {
                return;
            }

            var markerTransform = new Transform2D(markerPosition.Value, 0, Vector2.One);
            var serviceProvider = new ServiceContainer(provider);

            serviceProvider.AddService(typeof(Transform2D), markerTransform);
            serviceProvider.AddService(typeof(Vehicle), vehicle);
            player.PlayAction(task, serviceProvider);
        }
Ejemplo n.º 3
0
        static void ActivateMarker(ActionPlayer player, Vehicle vehicle, NavigationEnvironment environment, SlamController slam, int markerId, IServiceProvider provider)
        {
            var smartObject = environment.Landmarks.FirstOrDefault(landmark => landmark.MarkerId == markerId);

            if (smartObject == null)
            {
                return;
            }

            ActivateMarker(player, vehicle, environment, slam, smartObject, provider);
        }