public int randomizeChoiseOfCorridor() { int howManyAreThere; int randomizedOne; ConnectionMap conMap = dungeonCanvas.GetComponent <ConnectionMap>(); System.Random randomNumber = new System.Random(); howManyAreThere = conMap.getCorridorDependenciesList()[currentCorridorId].getNeighbourCorridor().Count; randomizedOne = randomNumber.Next(0, howManyAreThere); string devLog = "Out of following neighbours: "; for (int i = 0; i < howManyAreThere; i++) { devLog += " " + conMap.getCorridorDependenciesList()[currentCorridorId].getSpecificNeighbourCorridor(i).ToString(); } Debug.Log(devLog + " of corridor: " + currentCorridorId); return(conMap.getCorridorDependenciesList()[currentCorridorId].getSpecificNeighbourCorridor(randomizedOne)); }
void displayOptionsToChooseFrom(int idOfPopup) { List <int> neighbourCorridorList = connectionMap.getCorridorDependenciesList()[idOfCurrentCorridor].getNeighbourCorridor(); for (int i = 0; i < neighbourCorridorList.Count; i++) { if (i == 0) { if (GUI.Button(new Rect(popupBorderSpaceWidth, popupHeightSpaceForTitle + popupBorderSpaceHeight, popupOptionWidth, popupOptionHeight), "Corridor" + neighbourCorridorList[i])) { choosenCorridorId = neighbourCorridorList[i]; popupWindow = new Rect(0, 0, 0, 0); isCorridorChoosen = true; } } else if (i == 1) { if (GUI.Button(new Rect(popupBorderSpaceWidth + popupOptionWidth + popupSpaceBetweenWidth, popupHeightSpaceForTitle + popupBorderSpaceHeight, popupOptionWidth, popupOptionHeight), "Corridor" + neighbourCorridorList[i])) { choosenCorridorId = neighbourCorridorList[i]; popupWindow = new Rect(0, 0, 0, 0); isCorridorChoosen = true; } } else if (i == 2) { if (GUI.Button(new Rect(popupBorderSpaceWidth, popupHeightSpaceForTitle + popupBorderSpaceHeight + popupOptionHeight + popupSpaceBetweenHeight, popupOptionWidth, popupOptionHeight), "Corridor" + neighbourCorridorList[i])) { choosenCorridorId = neighbourCorridorList[i]; popupWindow = new Rect(0, 0, 0, 0); isCorridorChoosen = true; } } else { if (GUI.Button(new Rect(popupBorderSpaceWidth + popupOptionWidth + popupSpaceBetweenWidth, popupHeightSpaceForTitle + popupBorderSpaceHeight + popupOptionHeight + popupSpaceBetweenHeight, popupOptionWidth, popupOptionHeight), "Corridor" + neighbourCorridorList[i])) { choosenCorridorId = neighbourCorridorList[i]; popupWindow = new Rect(0, 0, 0, 0); isCorridorChoosen = true; } } } }