コード例 #1
0
ファイル: Maze.cs プロジェクト: kbarrett/maze
        void initialisePlayerSquare(byte playerNumber, Vector2 playerLoc)
        {
            MazePiece piece = getMazeLoc(playerLoc);

            piece = new MazePiece(mazePieceSize * (int)playerLoc.X, mazePieceSize * (int)playerLoc.Y, false);
            piece.givePlayer(playerNumber);
            piece.makeVisible();
            findVisibles((int)playerLoc.X, (int)playerLoc.Y);

            maze[(int)playerLoc.X, (int)playerLoc.Y] = piece;
        }
コード例 #2
0
ファイル: Maze.cs プロジェクト: kbarrett/maze
        public void reset(byte players)
        {
            do
            {
                Random random = new Random();
                for (int i = 0; i < mazeSize; ++i)
                {
                    for (int j = 0; j < mazeSize; ++j)
                    {
                        maze[i, j] = new MazePiece(i * mazePieceSize, j * mazePieceSize, random.Next(0, 3) % 3 == 0);
                    }
                }

                goal = new List <Vector2>();

                playerLoc = Vector2.Zero;
                initialisePlayerSquare(1, playerLoc);
                placeGoal(1);
                if (players > 1)
                {
                    player2Loc = new Vector2(mazeSize - 1, mazeSize - 1);
                    initialisePlayerSquare(2, player2Loc);
                    placeGoal(2);
                }
                else
                {
                    if (player2Loc != new Vector2(-1, -1))
                    {
                        player2Loc = new Vector2(-1, -1);
                        foreach (MazePiece mp in maze)
                        {
                            mp.removePlayer(2);
                        }
                    }
                }
            }while (goalRoute.Count < 10);
        }
コード例 #3
0
ファイル: Maze.cs プロジェクト: kbarrett/maze
        void initialisePlayerSquare(byte playerNumber, Vector2 playerLoc)
        {
            MazePiece piece = getMazeLoc(playerLoc);
            piece = new MazePiece(mazePieceSize * (int)playerLoc.X, mazePieceSize * (int)playerLoc.Y, false);
            piece.givePlayer(playerNumber);
            piece.makeVisible();
            findVisibles((int)playerLoc.X, (int)playerLoc.Y);

            maze[(int)playerLoc.X, (int)playerLoc.Y] = piece;
        }
コード例 #4
0
ファイル: Maze.cs プロジェクト: kbarrett/maze
        public void reset(byte players)
        {
            do
            {
                Random random = new Random();
                for (int i = 0; i < mazeSize; ++i)
                {
                    for (int j = 0; j < mazeSize; ++j)
                    {
                        maze[i, j] = new MazePiece(i * mazePieceSize, j * mazePieceSize, random.Next(0, 3) % 3 == 0);
                    }
                }

                goal = new List<Vector2>();

                playerLoc = Vector2.Zero;
                initialisePlayerSquare(1, playerLoc);
                placeGoal(1);
                if (players > 1)
                {
                    player2Loc = new Vector2(mazeSize - 1, mazeSize - 1);
                    initialisePlayerSquare(2, player2Loc);
                    placeGoal(2);
                }
                else
                {
                    if (player2Loc != new Vector2(-1, -1))
                    {
                        player2Loc = new Vector2(-1,-1);
                        foreach (MazePiece mp in maze)
                        {
                            mp.removePlayer(2);
                        }
                    }
                }
            }
            while (goalRoute.Count < 10);
        }