add souls and bones + tower cost and enemy drops

This commit is contained in:
Jim 2025-08-30 23:39:18 -04:00
parent bc02db7b26
commit 138a524abd
Signed by: jim
GPG key ID: 3D7D94BA53088BF4
18 changed files with 151 additions and 14 deletions

View file

@ -9,6 +9,7 @@ avian3d = { workspace = true }
state = { path = "../state" }
physics = { path = "../physics"}
resources = { path = "../resources" }
[lints]
workspace = true

View file

@ -6,6 +6,7 @@ use std::time::Duration;
use avian3d::prelude::*;
use bevy::prelude::*;
use resources::{Drops, Resources};
use state::GameSystemSet;
pub struct CombatPlugin;
@ -190,7 +191,17 @@ fn on_attack(
}
}
fn on_die(trigger: Trigger<Died>, names: Query<&Name>, mut commands: Commands) {
fn on_die(
trigger: Trigger<Died>,
names: Query<&Name>,
drops: Query<&Drops>,
mut resources: ResMut<Resources>,
mut commands: Commands,
) {
if let Ok(drop) = drops.get(trigger.target()) {
resources.souls += drop.souls;
info!("you now have {} souls", resources.souls);
}
if let Ok(mut ec) = commands.get_entity(trigger.target()) {
info!(
"{:?} killed {:?}!",