Exemplo n.º 1
0
    public void calculatePoolDepths()
    {
        for (int a = 0; a < rooms.Length; a++)
        {
            LevelUtils.countBlocks(rooms[a]);
        }

        //this loop goes through each room, adds up pool depths on all matching setpiece indexes,
        //and compares that to the current global pool depth for that setpiece index to obtain a highest possible count for that particular block.
        foreach (RoomInfo room in rooms)
        {
            for (int i = 0; i < room.connectingRooms.Length; i++)
            {
                RoomInfo connectingRoom = rooms[room.connectingRooms[i]];
                print("comparing room " + room.roomIndex + " and room " + room.connectingRooms[i]);
                for (int j = 0; j < room.blockPoolDepths.Length; j++)
                {
                    int possibleMaxPoolDepth = room.blockPoolDepths[j] + connectingRoom.blockPoolDepths[j];
                    if (possibleMaxPoolDepth > currentBlockPoolDepths[j])
                    {
                        currentBlockPoolDepths[j] = possibleMaxPoolDepth;
                    }
                    else if (room.blockPoolDepths[j] > currentBlockPoolDepths[j])
                    {
                        currentBlockPoolDepths[j] = room.blockPoolDepths[j];
                    }
                }
            }
        }
    }