public void ChangeSceneState(bool increase) { if (increase) { if (currentState != 5) { currentState += 1; } } else { if (currentState != 1) { currentState -= 1; } } foreach (TimeSceneNPC NPCs in GameObject.FindObjectsOfType <TimeSceneNPC>()) { NPCs.ChangeStateNPC(); } foreach (TimeSceneObjects objects in GameObject.FindObjectsOfTypeAll(typeof(TimeSceneObjects))) { objects.ChangeStateObject(); } }