projectile system

This commit is contained in:
Jim 2025-08-31 19:00:19 -04:00
parent 918b4884b2
commit ad4a2cf393
Signed by: jim
GPG key ID: 3D7D94BA53088BF4
17 changed files with 400 additions and 23 deletions

View file

@ -2,6 +2,8 @@
#![allow(clippy::type_complexity)]
#![allow(clippy::too_many_arguments)]
pub mod projectiles;
use std::time::Duration;
use avian3d::prelude::*;
@ -13,7 +15,8 @@ pub struct CombatPlugin;
impl Plugin for CombatPlugin {
fn build(&self, app: &mut App) {
app.add_observer(on_attack)
app.add_plugins(projectiles::ProjectilePlugin)
.add_observer(on_attack)
.add_observer(on_die)
.add_systems(
FixedUpdate,
@ -23,7 +26,7 @@ impl Plugin for CombatPlugin {
}
}
#[derive(PhysicsLayer, Default, Component, Clone, Debug, PartialEq, Eq, Reflect)]
#[derive(PhysicsLayer, Default, Component, Clone, Copy, Debug, PartialEq, Eq, Reflect)]
pub enum Team {
#[default]
Core,
@ -37,6 +40,12 @@ impl Team {
Team::Inhabitant => CollisionLayers::new(Team::Inhabitant, LayerMask::ALL),
}
}
pub fn enemy_layers(&self) -> LayerMask {
match self {
Team::Core => Team::Inhabitant.into(),
Team::Inhabitant => Team::Core.into(),
}
}
}
#[derive(Event, Debug, Default)]