Room.SetupRoom C# (CSharp) Method

SetupRoom() public method

public SetupRoom ( IntRange widthRange, IntRange heightRange, int columns, int rows ) : void
widthRange IntRange
heightRange IntRange
columns int
rows int
return void
    public void SetupRoom(IntRange widthRange, IntRange heightRange, int columns, int rows)
    {
        // Set a random width and height.
        roomWidth = widthRange.Random;
        roomHeight = heightRange.Random;

        // Set the x and y coordinates so the room is roughly in the middle of the board.
        //xPos = Mathf.RoundToInt(roomWidth / 2f);
        //yPos = Mathf.RoundToInt(rows / 2f - roomHeight / 2f);
		//The X and Y position of the first room should be in a set position since the hand crafted hub is stationary.
		xPos = 0;
		yPos = columns/2;
    }

Same methods

Room::SetupRoom ( IntRange widthRange, IntRange heightRange, int columns, int rows, Corridor corridor ) : void

Usage Example

コード例 #1
0
    void PlaceStartRoom()
    {
        Room startRoom = ScriptableObject.CreateInstance <Room>();

        startRoom.SetupRoom(roomWidth, roomHeight);
        rooms.Add(startRoom);
    }
All Usage Examples Of Room::SetupRoom