public RoomBuilder SetConnectedRoom(RoomIndicator connectedRoomInd) { if (connectedRoomInd != null) { ConnectedRoomInd = connectedRoomInd; } return(this); }
public RoomBuilder SetConnectedRoom(Guid?connectedRoomId) { if (connectedRoomId.HasValue) { ConnectedRoomInd = new RoomIndicator(connectedRoomId.Value); } return(this); }
private void EstablishConnections(Scene scene) { //Search for array of connected scenes from RoomIndicator object in new scene List <string> nameList = new List <string>(); foreach (GameObject go in scene.GetRootGameObjects()) { RoomIndicator indicator = go.GetComponentInChildren <RoomIndicator>(); if (indicator != null) { nameList.Add(indicator.GetConnectedRoom()); } } string[] nameArray = nameList.ToArray(); //Unload all unused scenes for (int i = 0; i < SceneManager.sceneCount; i++) { Scene currentScene = SceneManager.GetSceneAt(i); if (currentScene != scene) { //SceneManager.UnloadSceneAsync(currentScene); } } //Load new connected scenes if (nameArray != null) { foreach (string name in nameArray) { if (SceneManager.GetSceneByName(name).buildIndex == -1) { SceneManager.LoadSceneAsync(name, LoadSceneMode.Additive); } } } }