Exemplo n.º 1
0
        public void TestMethod1()
        {
            RandomMaze maze;
            maze = new RandomMaze(15, 9);
            //cube = new Cube();
            maze.GenerateMaze();

            maze.printMaze();

            maze.setStartPointAndDestPoint();

            maze.printMaze();
        }
        public MazeLandscape(LabGame game,int dimension,int seed )
        {
            this.seed = seed;
            this.dimension = dimension;
            this.game = game;
            maze = new RandomMaze(dimension, seed);
            cube = new Cube();
            maze.GenerateMaze();
            maze.setStartPointAndDestPoint();

            while (maze.destPoint == null)
            {
                game.mazeSeed=game.random.Next();
                this.seed = game.mazeSeed;
                maze = new RandomMaze(dimension, this.seed);
                //cube = new Cube();
                maze.GenerateMaze();
                maze.setStartPointAndDestPoint();
            }

            //display path.

            /*
                            List<Node> pathFromSrcToDest = maze.astar.FindPath(maze.astar.Float2DtoInt(maze.maze)
                , RandomMaze.WALL, maze.startPoint.x, maze.startPoint.y, maze.destPoint.x, maze.destPoint.y);
            */
            //maze.updateMazeRoad(pathFromSrcToDest, Project.Cube.goal);

            type = GameObjectType.MazeLandscape;
            //if maze existed before just remove it from model
            game.assets.modelDict.Remove(mazeModelName);
            myModel = game.assets.GetModel(mazeModelName, CreateMazeLandscapeModel);
            //radius = 0.5f;
            //frictionConstant = 0.4f;
            pos = new SharpDX.Vector3(0, 0, 0);
            GetParamsFromModel();
            effect = game.Content.Load<Effect>("Phong");
            Debug.WriteLine("maze created");
            entranceX = maze.startPoint.x * CUBESCALE * 2;
            entranceZ = maze.startPoint.y * CUBESCALE * 2;
            normalMaze = myModel.shapeArray;
        }