/// <summary>Returns a parent scene object based on given name</summary> public ParentScene GetParentScene(string nameOfParent) { for (int i = 0; i < parentScenes.Length; i++) { ParentScene parentScene = parentScenes[i]; if (parentScene.name == nameOfParent) { return(parentScene); } } return(default);
/// <summary>Populates the display with parent scene information</summary> public void Populate(string sceneName, ParentScene parentScene) { if (parentScene.ContainsChild(sceneName)) { PopulateUsingChild(sceneName, parentScene); } else { PopulateUsingParent(parentScene); } }
/// <summary>Populates the child scene display based on a child scene being entered</summary> private void PopulateUsingChild(string nameOfChildScene, ParentScene parentScene) { parentSceneIcon.sprite = parentScene.GetChild(nameOfChildScene).icon; for (int i = 0; i < navButtons.Length; i++) { navButtons[i].active = false; } PopulateNavButton(navButtons[0], new ChildScene { name = parentScene.name, icon = parentScene.icon }); List <ChildScene> childScenes = parentScene.ChildrenWithout(nameOfChildScene); for (int i = 0, j = 1; i < childScenes.Count; i++, j++) { PopulateNavButton(navButtons[j], childScenes[i]); } }
/// <summary>Populates the child scene display based on a parent scene being entered</summary> private void PopulateUsingParent(ParentScene parentScene) { parentSceneIcon.sprite = parentScene.icon; ChildScene[] childScenes = parentScene.childScenes; for (int i = 0; i < navButtons.Length; i++) { navButtons[i].active = false; } for (int i = 0; i < childScenes.Length; i++) { ChildSceneNavButton navbutton = navButtons[i]; ChildScene childScene = childScenes[i]; navbutton.active = true; navbutton.interactable = true; navbutton.nameOfSceneLoading = childScene.name; navbutton.icon = childScene.icon; } }