Exemplo n.º 1
0
    public int GenerateContent(int width, int height, GrammarPattern[] dungeonPattern)
    {
        DirectionFlag doorDirections = DirectionFlag.None;

        foreach (var edge in edges)
        {
            Vector2 adjPosition = GetPosFromId(edge.GetRoomId());

            if (pos.x == adjPosition.x && pos.y + 1 == adjPosition.y)
            {
                doorDirections |= DirectionFlag.North;
            }

            if (pos.x + 1 == adjPosition.x && pos.y == adjPosition.y)
            {
                doorDirections |= DirectionFlag.East;
            }

            if (pos.x == adjPosition.x && pos.y - 1 == adjPosition.y)
            {
                doorDirections |= DirectionFlag.South;
            }

            if (pos.x - 1 == adjPosition.x && pos.y == adjPosition.y)
            {
                doorDirections |= DirectionFlag.West;
            }
        }

        contentOfTheRoom = new RoomFiller(width, height, doorDirections, dungeonPattern, type, intensity);
        return(contentOfTheRoom.Generate());
    }
Exemplo n.º 2
0
    void Awake()
    {
        roomFill = gameObject.GetComponent <RoomFiller> ();

        buildProgress = BuildingStates.building;
//Room too big?
        roomWidth = Random.Range(5, 8);
        roomDepth = Random.Range(5, 8);

        CreateParents();
    }
Exemplo n.º 3
0
    void GetSpawnDimensions()
    {
        roomBuild = GameObject.Find("LevelManager").GetComponent <RoomBuilder> ();

        rW = roomBuild.roomWidth;
        rD = roomBuild.roomDepth;
        rH = roomBuild.roomHeight;

        spawnCount = (rW * rD) / 2;

        roomFill = GameObject.Find("LevelManager").GetComponent <RoomFiller>();
    }