IEnumerator LoadRoomRoutine(RoomDataForest data) { string levelName = currentWorldName + data.Name; // string levelName = data.Name; AsyncOperation loadedLevel = Application.LoadLevelAdditiveAsync(levelName); while (loadedLevel.isDone == false) { // Debug.Log("Loading " + levelName + " : " + Mathf.Round(loadedLevel.progress * 100) + " %"); yield return(null); } }
void UpdateRoomQueue() { if (isLoadingRoom == true) { return; } if (loadRoomQueue.Count == 0) { return; } currentLoadRoomData = loadRoomQueue.Dequeue(); isLoadingRoom = true; // Debug.Log("Loading new room " + currentLoadRoomData.X + " " + currentLoadRoomData.Y); StartCoroutine(LoadRoomRoutine(currentLoadRoomData)); }
void LoadRoom(string name, int x, int y) { if (DoesRoomExist(x, y) == true) { return; } //Hack method if (loadedRooms.Count + loadRoomQueue.Count == 7) { name = "End"; } if (loadedRooms.Count + loadRoomQueue.Count == 10) { name = "End"; } if (loadedRooms.Count + loadRoomQueue.Count == 15) { name = "End"; } if (loadedRooms.Count + loadRoomQueue.Count == 18) { name = "End"; } if (loadedRooms.Count + loadRoomQueue.Count == 25) { name = "End"; } //end of hack method RoomDataForest newRoomData = new RoomDataForest(); newRoomData.Name = name; newRoomData.X = x; newRoomData.Y = y; loadRoomQueue.Enqueue(newRoomData); }