20 lines
414 B
Rust
20 lines
414 B
Rust
|
use crate::EntityObject;
|
||
|
|
||
|
#[derive(Default)]
|
||
|
pub struct EntityObjectManager {
|
||
|
current_entity_id: u32,
|
||
|
}
|
||
|
|
||
|
impl EntityObjectManager {
|
||
|
pub(crate) fn fetch_add_entity_id(&mut self) -> u32 {
|
||
|
let id = self.current_entity_id;
|
||
|
self.current_entity_id += 1;
|
||
|
|
||
|
id
|
||
|
}
|
||
|
|
||
|
pub(crate) fn create_entity(&mut self) -> EntityObject {
|
||
|
EntityObject::new(self.fetch_add_entity_id())
|
||
|
}
|
||
|
}
|