A lot of stuff to Commit because I forgot to Commit in between (Don't do stuff like this, kids)

This commit is contained in:
cblech
2025-01-05 13:47:14 +01:00
parent 03d130cde6
commit 8c961cbf2d
87 changed files with 22246 additions and 42 deletions
+32
View File
@@ -31,12 +31,40 @@ public class SceneSwitcher : MonoBehaviour
}
}
[SerializeField]
private GameObject[] _deactivateChildrenOf;
public void SwitchScene(int sceneIndex)
{
for (var i = 0; i < transform.childCount; i++)
{
transform.GetChild(i).gameObject.SetActive(i == sceneIndex);
}
foreach (var toDeactivate in _deactivateChildrenOf)
{
foreach (Transform child in toDeactivate.transform)
{
child.gameObject.SetActive(false);
}
}
}
public void SwitchToNext()
{
for (var i = 0; i < transform.childCount; i++)
{
if (transform.GetChild(i).gameObject.activeSelf)
{
var nextIndex = i + 1;
if (nextIndex >= transform.childCount)
{
nextIndex = 0;
}
SwitchScene(nextIndex);
return;
}
}
}
public List<(string name, int index)> GetScenes()
@@ -49,4 +77,8 @@ public class SceneSwitcher : MonoBehaviour
}
return scenes;
}
public GameObject GetGameObject(int sceneIndex)
{
return transform.GetChild(sceneIndex).gameObject;
}
}