예제 #1
0
    //make the first corridor from each room's exit red and also handle the different room size
    private void markExits(Connector item, string newTag, DungeonPiece newDungeonPiece)
    {
        string exitParentTag = item.transform.parent.GetComponent <DungeonPiece>().CusTag[0];

        //if current dungeon piece is a corridor and next one is a room, mark the current dungeon piece red
        if (exitParentTag == "Corridor" || exitParentTag == "Corridor_Small")
        {
            if (newTag == "Room" || newTag == "Room_Small" || newTag == "Room_Hexagon" || newTag == "Room_Medium")
            {
                item.transform.parent.GetComponent <SpriteRenderer>().color = Color.red;
                newDungeonPiece.randomSize();
            }
        }//if current dungeon piece is a room and next one is a corridor, mark the corridor red
        else if (exitParentTag == "Room" || exitParentTag == "Room_Small" || exitParentTag == "Room_Hexagon" || exitParentTag == "Room_Medium")
        {
            if (newTag == "Corridor" || newTag == "Corridor_Small")
            {
                newDungeonPiece.transform.gameObject.GetComponent <SpriteRenderer>().color = Color.red;
            }
        }
    }
예제 #2
0
    private void Start()
    {
        startPiece = (DungeonPiece)Instantiate(StartPiece, transform.position, transform.rotation);

        pendingExits = new List <Connector>(startPiece.getExits());
    }