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(
|
2024-03-04 21:16:31 +00:00
|
|
|
LoadingState::new(AppState::CoreLoading)
|
|
|
|
.continue_to_state(AppState::MenuRunning)
|
|
|
|
.with_dynamic_assets_file::<StandardDynamicAssetCollection>(
|
|
|
|
"assets_core.assets.ron",
|
|
|
|
)
|
|
|
|
.load_collection::<CoreAssets>(),
|
2023-10-13 10:53:26 +00:00
|
|
|
)
|
|
|
|
// load game assets
|
|
|
|
.add_loading_state(
|
2024-03-04 21:16:31 +00:00
|
|
|
LoadingState::new(AppState::AppLoading)
|
|
|
|
.continue_to_state(AppState::AppRunning)
|
|
|
|
.with_dynamic_assets_file::<StandardDynamicAssetCollection>(
|
|
|
|
"assets_game.assets.ron",
|
|
|
|
)
|
|
|
|
.load_collection::<GameAssets>(),
|
|
|
|
);
|
2023-09-28 12:10:45 +00:00
|
|
|
}
|
2023-10-13 10:53:26 +00:00
|
|
|
}
|