bevy-combat-proto/src/plugin.rs

33 lines
993 B
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(),
))
.add_systems(Startup, setup)
.add_systems(Update, (
player::systems::handle_input,
timer::update_bpm_timers,
))
.register_component_as::<dyn Weapon, knife::Knife>();
}
}