I currently have this setup in my code:
pub enum Scene {
Intro(SceneIntro),
Menu(SceneMenu),
Map(SceneMap),
Options(SceneOptions),
Credits(SceneCredits),
Close(SceneClose),
}
pub enum SceneName {
Intro,
Menu,
Map,
Options,
Credits,
Close,
}
array_of_scenes: [Scene; 6]
// Passing the scene name to a function and working with the actual scene.
fn system_do_thing_with_scene(&mut self, scene_name: SceneName) {
match self.array_of_scenes[scene_name as usize] {
SceneIntro(scene_intro) => {...}
Scene::Menu(scene_menu) => {...}
Scene::Map(scene_map) => {...}
Scene::Options(scene_options) => {...}
Scene::Credits(scene_credits) => {...}
Scene::Close(scene_close) => {...}
}
}
As you can see, I need SceneName
and Scene
with "equivalent" (paired) variants, which I currently do manually. Is there an standardized way of doing this automated?