arrow ability (#29)

This commit is contained in:
extrawurst
2025-04-18 18:04:53 +02:00
committed by GitHub
parent 2691dc129a
commit 68ea17a93a
5 changed files with 121 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
mod arrow;
mod gun;
mod thrown;
@@ -73,11 +74,14 @@ impl TriggerData {
#[derive(Event, Reflect)]
pub struct TriggerGun(pub TriggerData);
#[derive(Event, Reflect)]
pub struct TriggerArrow(pub TriggerData);
#[derive(Event, Reflect)]
pub struct TriggerThrow(pub TriggerData);
pub fn plugin(app: &mut App) {
app.add_plugins(gun::plugin);
app.add_plugins(thrown::plugin);
app.add_plugins(arrow::plugin);
app.add_systems(Update, enemy_hit.run_if(in_state(GameState::Playing)));
@@ -155,7 +159,8 @@ fn on_trigger_state(
match ability {
HeadAbility::Thrown => commands.trigger(TriggerThrow(trigger_state)),
HeadAbility::Gun => commands.trigger(TriggerGun(trigger_state)),
_ => (),
HeadAbility::Arrow => commands.trigger(TriggerArrow(trigger_state)),
HeadAbility::None => (),
};
}
}