diff --git a/src/lib.rs b/src/lib.rs index 588cd86..a31f39f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,6 +14,7 @@ mod player; mod spawner; mod ui_handler; mod voxel_painting; +mod scene_handler; use crate::actions::ActionsPlugin; use crate::audio::InternalAudioPlugin; @@ -25,6 +26,7 @@ use crate::menu::MenuPlugin; use crate::player::PlayerPlugin; use crate::ui_handler::UiHandlerPlugin; use crate::voxel_painting::paint_voxel_system; +use crate::scene_handler::SceneSwitchPlugin; use bevy::app::App; #[cfg(debug_assertions)] use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}; @@ -51,6 +53,7 @@ impl Plugin for GamePlugin { app.add_state::() .add_plugins(( LoadingPlugin, + SceneSwitchPlugin, MenuPlugin, ActionsPlugin, InternalAudioPlugin, diff --git a/src/map_setup.rs b/src/map_setup.rs index dc5edc5..5ba1fd8 100644 --- a/src/map_setup.rs +++ b/src/map_setup.rs @@ -69,16 +69,6 @@ pub fn map_setup(mut commands: Commands) { // --- Just scene setup below --- - // camera - commands.spawn(( - Camera3dBundle { - transform: Transform::from_xyz(-200.0, 180.0, -200.0), - ..default() - }, - // This tells bevy_voxel_world tos use this cameras transform to calculate spawning area - VoxelWorldCamera, - )); - // Sun let cascade_shadow_config = CascadeShadowConfigBuilder { ..default() }.build(); commands.spawn(DirectionalLightBundle { diff --git a/src/menu.rs b/src/menu.rs index 24f6599..b590e75 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -2,7 +2,7 @@ use crate::core_components::ChangeState; use crate::loading::TextureAssets; use crate::GameState; use bevy::prelude::*; -use bevy_voxel_world::prelude::*; + pub struct MenuPlugin; /// This plugin is responsible for the game menu (containing only one button...) @@ -21,9 +21,6 @@ struct ButtonColors { hovered: Color, } -#[derive(Component)] -struct MenuCamera; - impl Default for ButtonColors { fn default() -> Self { ButtonColors { @@ -39,14 +36,8 @@ struct Menu; fn setup_menu( mut commands: Commands, textures: Res, - mut game_camera_query: Query<&mut Camera, With>, ) { - // disable Game Camera - let mut camera = game_camera_query.single_mut(); - camera.is_active = false; - info!("menu"); - commands.spawn((Camera2dBundle::default(), MenuCamera)); commands .spawn(( NodeBundle { @@ -202,21 +193,14 @@ fn click_play_button( ), (Changed, With