Exemple #1
0
 private void PlaceWallOrPassage(RoomInside currentRoom, RoomInside adjacentRoom, bool activeWall)
 {
     if (activeWall)
     {
         currentRoom.transform.GetChild((int)WallDirection.West).gameObject.SetActive(true);
         adjacentRoom.transform.GetChild((int)WallDirection.East).gameObject.SetActive(true);
         activeWallCount++;
     }
     else
     {
         currentRoom.transform.GetChild((int)WallDirection.West).gameObject.SetActive(false);
         adjacentRoom.transform.GetChild((int)WallDirection.East).gameObject.SetActive(false);
     }
 }
Exemple #2
0
    private void CheckHorzPartitions(RoomInside room1, RoomInside room2)
    {
        int       room1ChildCount = room1.transform.childCount;
        int       room2ChildCount = room2.transform.childCount;
        Transform part1           = null;
        Transform part2           = null;

        if (room1ChildCount == 5)
        {
            part1 = room1.transform.GetChild((int)WallDirection.North);
        }
        else if (room1ChildCount == 6)
        {
            part1 = room1.transform.GetChild((int)WallDirection.North + 1);
        }

        if (room2ChildCount == 5)
        {
            part2 = room2.transform.GetChild((int)WallDirection.South);
        }
        else if (room2ChildCount == 6)
        {
            part2 = room2.transform.GetChild((int)WallDirection.South + 1);
        }

        int room1SpriteCount = part1.childCount;
        int room2SpriteCount = part2.childCount;
        int dCount           = room1SpriteCount - room2SpriteCount;

        if (dCount > 0 || dCount == 0)
        {
            part2.gameObject.SetActive(false);
        }
        else
        {
            for (int i = 0; i < (room2SpriteCount - Mathf.Abs(dCount)); i++)
            {
                part2.GetChild(i).gameObject.SetActive(false);
            }
        }
    }
Exemple #3
0
 private void PlaceRoom(GameObject roomParent, RoomInside newRoom, float xPos, float yPos)
 {
     newRoom.transform.localPosition = new Vector3(xPos, yPos, 0);
     newRoom.transform.SetParent(roomParent.transform, true);
 }