void MakeDifficulties() { float lastDiff = dungeonLevel; float maxDiff = 0; foreach (GameObject rm in rooms) { MapRoomController rmCntrl = rm.GetComponent <MapRoomController>(); float newDiff = 0; if (rmCntrl.coreRoom) { newDiff = lastDiff + Random.Range(0.05f, 0.25f); if (maxDiff < newDiff) { maxDiff = newDiff; } } else // nerf extra rooms { newDiff = Random.Range(dungeonLevel, maxDiff); } rmCntrl.SetRoomDiffuculty(newDiff); lastDiff = newDiff; if (rmCntrl.roomIndex != 0) { rmCntrl.ShowRoom(false); rmCntrl.ShowPassages(false); } } }
public void UpdateNeighbours() { if (neighbourLeft != null && wallLeft != Wall.Solid) { neighbourLeft.ShowRoom(true); } if (neighbourUp != null && wallUp != Wall.Solid) { neighbourUp.ShowRoom(true); } if (neighbourRight != null && wallRight != Wall.Solid) { neighbourRight.ShowRoom(true); } if (neighbourDown != null && wallDown != Wall.Solid) { neighbourDown.ShowRoom(true); } }
void SetActiveRoom(GameObject room) { MapRoomController roomController = room.GetComponent <MapRoomController>(); foreach (GameObject _room in rooms) { MapRoomController _roomController = _room.GetComponent <MapRoomController>(); _roomController.ActiveRoom(false); if (_roomController == roomController) { activeRoom = _roomController; _roomController.ActiveRoom(true); } } //set buttons types SetButtonsTypes(); roomController.ShowRoom(true); roomController.ShowPassages(true); GetRoomNeighbours(roomController); roomController.UpdateNeighbours(); activeRoom.SpawnChest(); }