Exemplo n.º 1
0
        public static Tile FullTile(int row, int col)
        {
            Tile t = new Tile(row, col);
            t.LeftWall = WallState.Sealed;
            t.RightWall = WallState.Sealed;
            t.UpWall = WallState.Sealed;
            t.DownWall = WallState.Sealed;

            return t;
        }
Exemplo n.º 2
0
        public static Tile RandomTile(int row, int col, Random random)
        {
            Tile t = new Tile(row, col);
            int rand = random.Next(0, 2);
            t.LeftWall = rand == 0 ? WallState.Sealed : WallState.None;
            rand = random.Next(0, 2);
            t.RightWall = rand == 0 ? WallState.Sealed : WallState.None;
            rand = random.Next(0, 2);
            t.UpWall = rand == 0 ? WallState.Sealed : WallState.None;
            rand = random.Next(0, 2);
            t.DownWall = rand == 0 ? WallState.Sealed : WallState.None;

            return t;
        }
Exemplo n.º 3
0
        public static Tile[,] GenerateMaze(int row, int col, int seed)
        {
            Random rng = new Random(seed);
            Tile[,] tiles = new Tile[row, col];
            for (int r = 0; r < row; r++)
            {

                for (int c = 0; c < col; c++)
                {
                    if (r < 1 || r >= (row - 1) || c < 1 || c >= (col - 1))
                    {
                        tiles[r, c] = ExitTile(r, c);
                    }
                    else
                    {
                        tiles[r, c] = RandomTile(r, c, rng);
                    }
                }
            }

            return tiles;
        }
Exemplo n.º 4
0
 public static WallState GetBackWallOf(Tile tile, Direction facingDirection)
 {
     if (facingDirection == Direction.Up)
     {
         return tile.DownWall;
     }
     else if (facingDirection == Direction.Down)
     {
         return tile.UpWall;
     }
     else if (facingDirection == Direction.Left)
     {
         return tile.RightWall;
     }
     else if (facingDirection == Direction.Right)
     {
         return tile.LeftWall;
     }
     else // None
     {
         return WallState.None;
     }
 }
Exemplo n.º 5
0
Arquivo: Maze.cs Projeto: ZwodahS/LD25
 public void PlaceTile(Tile NextTile, Grid g)
 {
     NextTile.CurrentGrid = g;
     Tiles[g.Row, g.Col] = NextTile;
 }
Exemplo n.º 6
0
Arquivo: Maze.cs Projeto: ZwodahS/LD25
 public Maze(Tile[,] tiles)
 {
     this.Tiles = tiles;
     Humans = new List<Unit>();
     rng = new Random();
 }
Exemplo n.º 7
0
 public static Tile ExitTile(int row, int col)
 {
     Tile t = new Tile(row, col);
     t.IsExit = true;
     return t;
 }
Exemplo n.º 8
0
 public void RandomNext()
 {
     NextTile = MazeGenerator.RandomTile(0,0,new Random());
     NextTile.CurrentGrid = new Grid(-1, -1);
 }
Exemplo n.º 9
0
 public static void GetBackWallPair(Tile currTile, Tile targetTile, Direction facingDirection, out WallState currWall, out WallState targetWall)
 {
     currWall = GetBackWallOf(currTile, facingDirection);
     targetWall = GetFrontWallOf(targetTile, facingDirection);
 }