different ammo per head (#30)

This commit is contained in:
extrawurst
2025-04-18 19:21:11 +02:00
committed by GitHub
parent 68ea17a93a
commit 94cd9c9cc4
7 changed files with 36 additions and 21 deletions

View File

@@ -4,6 +4,7 @@ mod ui_head_state;
use crate::{
GameState,
heads::{HEAD_COUNT, HeadState},
heads_database::HeadsDatabase,
};
use bevy::prelude::*;
@@ -36,10 +37,10 @@ pub fn plugin(app: &mut App) {
app.add_systems(OnEnter(GameState::Playing), setup);
}
fn setup(mut commands: Commands) {
fn setup(mut commands: Commands, heads: Res<HeadsDatabase>) {
commands.insert_resource(Backpack {
heads: (0usize..HEAD_COUNT)
.map(|i| HeadState::new(i, 10))
.map(|i| HeadState::new(i, heads.as_ref()))
.collect(),
});
}