use crate::{ecs, traits::System};
use super::{ActionSender, HandlerRegistry};
#[derive(Debug)]
pub struct WorldManager {
world: ecs::World,
}
impl WorldManager {
pub fn new() -> Self {
let world = ecs::World::new();
Self { world }
}
pub fn add_system<S: System>(&mut self, system: S) {
system.register_to(HandlerRegistry {
world: &mut self.world,
});
}
pub(crate) fn action_sender(&mut self) -> ActionSender {
ActionSender {
world: &mut self.world,
}
}
}
impl Default for WorldManager {
fn default() -> Self {
Self::new()
}
}