/// <summary> /// Gets each file within a directory and checks to see if the room gameobject already exists. /// if it does not exist it pushes the room to a stack to be read /// </summary> /// <param name="Dir"></param> public void LoadRoom(DirectoryInfo Dir) { foreach (FileInfo f in Dir.GetFiles()) { fileToLoad file = new fileToLoad(); int numNameComponents = f.Name.Split('.').Length; file.filePath = f.FullName; file.name = f.Name.Split('.')[0]; string extension = '.' + f.Name.Split('.')[numNameComponents - 1]; if (extension.Equals(Config.Current.Room.TangoFileExtension)) { bool cached = false; foreach (GameObject g in roomList) { if (g.name == file.name) { cached = true; } } if (cached == false) { FilesToLoad.Push(file); } } } }
// Update is called once per frame void Update() { if (FilesToLoad.Count > 0) { fileToLoad f = FilesToLoad.Pop(); ReadRoom(f.filePath, f.name); } }
void Update() { if (FilesToLoad.Count > 0) { fileToLoad f = FilesToLoad.Pop(); ReadRoom(f.filePath, f.name); } RegisterAllTangoRooms(); CullLists(); }