bevy-combat-proto/src/plugin.rs

39 lines
1.2 KiB
Rust

//! Plugin module where everything is connected
use bevy::prelude::*;
use bevy_rapier2d::prelude::*;
use bevy_trait_query::RegisterExt;
use leafwing_input_manager::prelude::*;
use seldom_state::prelude::*;
use crate::{*, player::weapon::*};
/// Plugin that connects everything needed for this prototype
pub struct GamePlugin;
impl Plugin for GamePlugin {
fn build(&self, app: &mut App) {
app.add_plugins((
RapierDebugRenderPlugin::default(),
RapierPhysicsPlugin::<()>::default()
.with_length_unit(meters(1.)),
InputManagerPlugin::<input::PlayerInput>::default(),
InputManagerPlugin::<input::DebugInput>::default(),
StateMachinePlugin::default(),
))
.insert_resource(BpmTimer::new(120.))
.add_systems(Startup, (
setup,
setup_animated_sprite_dummy,
))
.add_systems(Update, (
anim::sprite::update_animated_sprites,
combat::attack::update_attack_areas,
player::systems::handle_input,
timer::update_bpm_timer,
))
.register_component_as::<dyn Weapon, knife::Knife>();
}
}