2023-09-28 12:10:45 +00:00
|
|
|
pub mod assets_core;
|
|
|
|
pub use assets_core::*;
|
|
|
|
|
|
|
|
pub mod assets_game;
|
|
|
|
pub use assets_game::*;
|
|
|
|
|
|
|
|
use bevy::prelude::*;
|
|
|
|
use bevy_asset_loader::prelude::*;
|
|
|
|
|
2023-10-13 10:53:26 +00:00
|
|
|
use crate::state::AppState;
|
2023-09-28 12:10:45 +00:00
|
|
|
|
|
|
|
pub struct AssetsPlugin;
|
|
|
|
impl Plugin for AssetsPlugin {
|
2023-10-13 10:53:26 +00:00
|
|
|
fn build(&self, app: &mut App) {
|
|
|
|
app
|
|
|
|
// load core assets (ie assets needed in the main menu, and everywhere else before loading more assets in game)
|
|
|
|
.add_loading_state(
|
|
|
|
LoadingState::new(AppState::CoreLoading).continue_to_state(AppState::MenuRunning),
|
|
|
|
)
|
|
|
|
.add_dynamic_collection_to_loading_state::<_, StandardDynamicAssetCollection>(
|
|
|
|
AppState::CoreLoading,
|
|
|
|
"advanced/assets_core.assets.ron",
|
|
|
|
)
|
|
|
|
.add_collection_to_loading_state::<_, CoreAssets>(AppState::CoreLoading)
|
|
|
|
// load game assets
|
|
|
|
.add_loading_state(
|
|
|
|
LoadingState::new(AppState::AppLoading).continue_to_state(AppState::AppRunning),
|
|
|
|
)
|
|
|
|
.add_dynamic_collection_to_loading_state::<_, StandardDynamicAssetCollection>(
|
|
|
|
AppState::AppLoading,
|
|
|
|
"advanced/assets_game.assets.ron",
|
|
|
|
)
|
|
|
|
.add_collection_to_loading_state::<_, GameAssets>(AppState::AppLoading);
|
2023-09-28 12:10:45 +00:00
|
|
|
}
|
2023-10-13 10:53:26 +00:00
|
|
|
}
|