static void n_DoCommand_Lorbotix_robot_base_DeviceCommand_J(IntPtr jnienv, IntPtr native__this, IntPtr native_p0, long p1)
        {
            IControlStrategy __this = Java.Lang.Object.GetObject <IControlStrategy> (native__this, JniHandleOwnership.DoNotTransfer);

            global::Orbotix.Robot.Base.DeviceCommand p0 = Java.Lang.Object.GetObject <global::Orbotix.Robot.Base.DeviceCommand> (native_p0, JniHandleOwnership.DoNotTransfer);
            __this.DoCommand(p0, p1);
        }
Ejemplo n.º 2
0
 public void SwitchControl()
 {
     if (_strategy is MapEditorStrategy)
     {
         _strategy = new LocationsEditorStrategy(this);
     }
     else if (_strategy is LocationsEditorStrategy)
     {
         _strategy = new MapEditorStrategy(this);
     }
 }
Ejemplo n.º 3
0
 public CarAgent(Model model, float modelRotate, float width, float height, bool opposite, GameObjectType type, IGameStateProvider gameStateProvider, IControlStrategy drivingStrategy)
     : base(model, true)
 {
     _gameStateProvider = gameStateProvider;
     Width             = width;
     HardCodedHeight   = height;
     ModelRotate       = modelRotate;
     OppositeDirection = opposite;
     if (drivingStrategy != null)
     {
         _strategy            = drivingStrategy;
         _strategy.GameObject = this;
     }
     Type = type;
     Id   = Guid.NewGuid().ToString();
 }
Ejemplo n.º 4
0
        private void BeginSearch()
        {
            if (_finish.Count != 1)
            {
                MessageBox.Show("Only single destination point is currently supported.");
                return;
            }

            if (_start.Count < 1)
            {
                MessageBox.Show("At least one starting point should be provided.");
                return;
            }

            var strategy = _strategy;

            _strategy = new IgnoreStrategy();

            foreach (var control in MapGrid.Children.Cast <Shape>().Where(c => c.Fill == _waypointBrush))
            {
                control.Fill = _normalBrush;
            }

            var tracer      = new Tracer <Wave>();
            var map         = new GridMap(_table);
            var destination = _finish.First();

            foreach (var location in _start)
            {
                var route = tracer.FindShortestPath(location, destination, map);
                if (route == null)
                {
                    continue;
                }
                foreach (var waypoint in route.Skip(1).Take(route.Count - 2))
                {
                    var control = MapGrid.Children[(int)(waypoint.X * Columns + waypoint.Y)] as Shape;
                    control.Fill = _waypointBrush;
                }
            }

            _strategy = strategy;
        }
Ejemplo n.º 5
0
        public MainWindow()
        {
            InitializeComponent();

            _normalBrush   = (Resources["NormalBrush"] as Brush) ?? new SolidColorBrush(Colors.LightGreen);
            _obstacleBrush = (Resources["ObstacleBrush"] as Brush) ?? new SolidColorBrush(Colors.Gray);
            _waypointBrush = (Resources["WaypointBrush"] as Brush) ?? new SolidColorBrush(Colors.LightBlue);
            _startBrush    = (Resources["StartBrush"] as Brush) ?? new SolidColorBrush(Colors.DarkBlue);
            _finishBrush   = (Resources["FinishBrush"] as Brush) ?? new SolidColorBrush(Colors.Blue);

            _strategy = new MapEditorStrategy(this);

            MapGrid.Width  = Columns * CellWidth;
            MapGrid.Height = Rows * CellHeight;

            for (int x = 0; x < Columns; x++)
            {
                MapGrid.ColumnDefinitions.Add(new ColumnDefinition());
            }
            for (int y = 0; y < Rows; y++)
            {
                MapGrid.RowDefinitions.Add(new RowDefinition());
            }

            for (int x = 0; x < Columns; x++)
            {
                for (int y = 0; y < Rows; y++)
                {
                    _table[x, y] = true;
                    var control = new Rectangle {
                        Fill = _normalBrush, Focusable = false
                    };
                    control.MouseDown += OnClick;
                    Grid.SetColumn(control, x);
                    Grid.SetRow(control, y);
                    MapGrid.Children.Add(control);
                }
            }

            KeyDown += OnKeyDown;
        }
Ejemplo n.º 6
0
        private CarAgent CreateVehicleAgent(Model model, int lane, bool opposite, float y, float vanWidth, float height, float v, float rotation, IControlStrategy drivingStrategy = null)
        {
            if (drivingStrategy == null)
            {
                drivingStrategy = new OvertakingStrategy(v, lane, _gameStateProvider);
            }

            var van = new CarAgent(model, rotation, vanWidth, height, opposite, GameObjectType.Car, _gameStateProvider, drivingStrategy)
            {
                VY    = v,
                MaxVY = 100f / 3.6f,
                X     = GetLaneCenter(lane, opposite),
                Y     = y
            };

            return(van);
        }
        static void n_Close(IntPtr jnienv, IntPtr native__this)
        {
            IControlStrategy __this = Java.Lang.Object.GetObject <IControlStrategy> (native__this, JniHandleOwnership.DoNotTransfer);

            __this.Close();
        }
Ejemplo n.º 8
0
 public CarAgent(Model model, float modelRotate, float width, float height, bool opposite,
                 GameObjectType type, IControlStrategy drivingStrategy)
     : this(model, modelRotate, width, height, opposite, type, drivingStrategy, new BasicCollisionStrategy())
 {
 }