Ejemplo n.º 1
0
    public Maze(int seed, int x, int y)
    {
        if (x <= 0)
        {
            x = 1;
        }
        if (y <= 0)
        {
            y = 1;
        }

        mazeData = new IntSquare(x * 2 + 1, y * 2 + 1);
        CreateMaze(seed);
    }
Ejemplo n.º 2
0
    public void InstantiateMap(Maze maze)
    {
        IntSquare mazeData = maze.mazeData;

        for (int y = 1; y < mazeData.size.y; y += 2)
        {
            for (int x = 1; x < mazeData.size.x; x += 2)
            {
                GameObject room = Instantiate(roomPrefab, Vector3.zero, Quaternion.identity);
                room.GetComponent <Room>().OpenDoor(maze.GetRoomNumber(x, y));
                room.transform.position = new Vector3(x * 5, 0, -y * 5);
            }
        }
    }