pub struct Level { /* private fields */ }Expand description
Main container for game objects.
Each Level has a name and a vector of owned objects.
Implementations§
Source§impl Level
impl Level
Sourcepub fn new(name: String, content: Vec<Box<dyn Object>>) -> Self
pub fn new(name: String, content: Vec<Box<dyn Object>>) -> Self
Constructs Level with given name and content.
Sourcepub fn handle(
&mut self,
sender: &mut dyn Entity,
target: i32,
action: Action,
) -> Result<(), GameError>
pub fn handle( &mut self, sender: &mut dyn Entity, target: i32, action: Action, ) -> Result<(), GameError>
Handles players’ actions.
sender is the Entity that issued an action.
target is the index of targeted object in content
pub fn add_child(&mut self, item: Box<impl Item + 'static>)
pub fn get_objects(&mut self) -> &mut Vec<Box<dyn Object>>
Auto Trait Implementations§
impl Freeze for Level
impl !RefUnwindSafe for Level
impl !Send for Level
impl !Sync for Level
impl Unpin for Level
impl !UnwindSafe for Level
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more