Merge branch 'main' of github.com-personal:Back777space/among-me

This commit is contained in:
Back777space
2025-04-06 22:25:27 +02:00
11 changed files with 782 additions and 256 deletions

View File

@@ -9,19 +9,18 @@ use bevy_kira_audio::{AudioPlugin, AudioSource};
/// Loads resources and assets for the game.
/// See assets/main.assets.ron for the actual paths used.
pub(super) fn plugin(app: &mut App) {
app.add_plugins(AudioPlugin)
.add_loading_state(
LoadingState::new(GameState::Loading)
.continue_to_state(GameState::Menu)
.with_dynamic_assets_file::<StandardDynamicAssetCollection>("main.assets.ron")
.load_collection::<ImageAssets>()
.load_collection::<FlashlightAssets>()
.load_collection::<GltfAssets>()
.load_collection::<AudioAssets>(),
// .load_collection::<TextureAssets>()
// .load_collection::<GrassAssets>()
// .load_collection::<ConfigAssets>(),
);
app.add_plugins(AudioPlugin).add_loading_state(
LoadingState::new(GameState::Loading)
.continue_to_state(GameState::Menu)
.with_dynamic_assets_file::<StandardDynamicAssetCollection>("main.assets.ron")
.load_collection::<ImageAssets>()
.load_collection::<FlashlightAssets>()
.load_collection::<GltfAssets>()
.load_collection::<AudioAssets>(),
// .load_collection::<TextureAssets>()
// .load_collection::<GrassAssets>()
// .load_collection::<ConfigAssets>(),
);
}
// the following asset collections will be loaded during the State `GameState::InitialLoading`
@@ -39,6 +38,8 @@ pub(crate) struct AudioAssets {
pub(crate) struct GltfAssets {
#[asset(key = "library", collection(typed, mapped))]
pub(crate) library: HashMap<String, Handle<Gltf>>,
#[asset(key = "id_card")]
pub(crate) card: Handle<Gltf>,
}
#[derive(AssetCollection, Resource, Clone)]
@@ -54,10 +55,28 @@ pub(crate) struct ConfigAssets {}
pub(crate) struct ImageAssets {
#[asset(key = "lebron")]
pub(crate) king: Handle<Image>,
#[asset(key = "id_card_toolbar")]
pub(crate) id_card: Handle<Image>,
}
#[derive(AssetCollection, Resource, Clone)]
pub(crate) struct FlashlightAssets {
#[asset(key = "flash_hold_0")]
pub(crate) flash_hold_0: Handle<Image>,
#[asset(key = "flash_hold_0_pressed")]
pub(crate) flash_hold_0_pressed: Handle<Image>,
#[asset(key = "flash_hold_1")]
pub(crate) flash_hold_1: Handle<Image>,
#[asset(key = "flash_hold_1_pressed")]
pub(crate) flash_hold_1_pressed: Handle<Image>,
#[asset(key = "flash_hold_2")]
pub(crate) flash_hold_2: Handle<Image>,
#[asset(key = "flash_hold_2_pressed")]
pub(crate) flash_hold_2_pressed: Handle<Image>,
#[asset(key = "flash_hold_3")]
pub(crate) flash_hold_3: Handle<Image>,
#[asset(key = "flash_hold_3_pressed")]
pub(crate) flash_hold_3_pressed: Handle<Image>,
#[asset(key = "flash_hold_4")]
pub(crate) flash_hold_4: Handle<Image>,
#[asset(key = "flash_hold_4_pressed")]