Exemple #1
0
        /// <summary>
        ///   Initializes a new instance.
        /// </summary>
        public Model(PreControl preControl, MainControl mainControl, EndControl endControl, Vehicle[] vehicles = null)
        {
            vehicles = vehicles ?? new[]
            {
                new Vehicle {
                    Kind = VehicleKind.OverheightVehicle
                },
                new Vehicle {
                    Kind = VehicleKind.OverheightVehicle
                },
                new Vehicle {
                    Kind = VehicleKind.HighVehicle
                }
            };

            VehicleSet = new VehicleSet(vehicles);
            VehicleSet.FinishedObserver = new FinishedObserverDisabled();

            SetupController(preControl);
            SetupController(mainControl);
            SetupController(endControl);

            HeightControl = new HeightControl(preControl, mainControl, endControl);
            Bind(nameof(VehicleSet.IsTunnelClosed), nameof(HeightControl.TrafficLights.IsRed));
        }
Exemple #2
0
        /// <summary>
        /// color the maze
        /// </summary>
        /// <param name="mazewall2d">maze 2d</param>
        /// <param name="maze">maze 3d m</param>
        /// <param name="curr_layer">current layer</param>
        /// <param name="final_layer">final layer</param>
        /// <param name="s">name of maze</param>
        private void colorMazeWall(Grid mazewall2d, Maze maze, int curr_layer, int final_layer)
        {
            Maze2d maze2d = maze as Maze2d;

            for (int row = 0; row < maze2d.MX * 2 - 1; row++)
            {
                for (int column = 0; column < maze2d.MY * 2 - 1; column++)
                {
                    if (curr_layer == 0 && maze2d.getStartPosition().X == row && maze2d.getStartPosition().Y == column)
                    {
                        StartControl StartCell = new StartControl();
                        Grid.SetColumn(StartCell, column);
                        Grid.SetRow(StartCell, row);
                        mazewall2d.Children.Add(StartCell);
                    }

                    else
                    {
                        if (curr_layer == final_layer - 1 && maze2d.getGoalPosition().X == row && maze2d.getGoalPosition().Y == column)
                        {
                            EndControl EndCell = new EndControl();
                            Grid.SetColumn(EndCell, column);
                            Grid.SetRow(EndCell, row);
                            mazewall2d.Children.Add(EndCell);
                        }
                        else
                        {
                            if (maze2d.MAZE2d[row, column] == 1)
                            {
                                MazeCell1 CellWall = new MazeCell1();
                                Grid.SetColumn(CellWall, column);
                                Grid.SetRow(CellWall, row);
                                mazewall2d.Children.Add(CellWall);
                            }

                            else
                            {
                                GrassCell grassCell = new GrassCell();
                                Grid.SetColumn(grassCell, column);
                                Grid.SetRow(grassCell, row);
                                mazewall2d.Children.Add(grassCell);
                            }
                        }
                    }
                }
            }
            m_layerOfGrid[curr_layer] = mazewall2d;
        }
Exemple #3
0
        /// <summary>
        /// click help button
        /// </summary>
        /// <param name="view">View IVIEw</param>
        /// <param name="model">model IMOdel</param>
        public Help_w(IModel model, IView view)
        {
            InitializeComponent();
            m_model = model;
            m_view  = view;
            MazeCell1    wall   = new MazeCell1();
            GrassCell    grass  = new GrassCell();
            StepsCell    steps  = new StepsCell();
            ArrowControl jumper = new ArrowControl();
            StartControl start  = new StartControl();
            EndControl   end    = new EndControl();

            Grass.Children.Add(grass);
            Wall.Children.Add(wall);
            Steps.Children.Add(steps);
            Jumper.Children.Add(jumper);
            Start.Children.Add(start);
            Goal.Children.Add(end);
        }
Exemple #4
0
        /// <summary>
        ///   Initializes a new variant with the given control types.
        /// </summary>
        public static Model CreateVariant(PreControl preControl, MainControl mainControl, EndControl endControl, Vehicle[] vehicles = null)
        {
            var model = new Model(vehicles);

            model.SetupController(preControl);
            model.SetupController(mainControl);
            model.SetupController(endControl);

            model.HeightControl = new HeightControl
            {
                PreControl    = preControl,
                MainControl   = mainControl,
                EndControl    = endControl,
                TrafficLights = new TrafficLights()
            };

            return(model);
        }