Trait keeshond::scene::ThinkerSystem
source · [−]pub trait ThinkerSystem<T: SceneType + 'static> {
fn think(&mut self, args: ThinkerArgs<'_, T>);
fn start(&mut self, args: ThinkerArgs<'_, T>) { ... }
fn start_late(&mut self, args: ThinkerArgs<'_, T>) { ... }
fn end(&mut self, args: ThinkerArgs<'_, T>) { ... }
fn priority(&self) -> i32 { ... }
}
Expand description
A system that runs game logic every frame, typically giving Entities behaviors based on which Components they have.
Required Methods
fn think(&mut self, args: ThinkerArgs<'_, T>)
fn think(&mut self, args: ThinkerArgs<'_, T>)
Called once every logic frame. This is where you do your main processing.
Provided Methods
fn start(&mut self, args: ThinkerArgs<'_, T>)
fn start(&mut self, args: ThinkerArgs<'_, T>)
Called before the first frame of logic processing. You can use this to spawn in objects and do any other necessary setup.
fn start_late(&mut self, args: ThinkerArgs<'_, T>)
fn start_late(&mut self, args: ThinkerArgs<'_, T>)
Called after ThinkerSystem::start() but before the first frame of logic processing. This is useful if you need to do initialization tasks after any deferred actions such as object spawning.
fn end(&mut self, args: ThinkerArgs<'_, T>)
fn end(&mut self, args: ThinkerArgs<'_, T>)
Called when the scene is ending, such as when the gameloop is switching to a new scene. This is a good place to do resource cleanup, save settings and persistent data, or other tasks.
Used to determine the order of execution of each ThinkerSystem. Lower number priority systems are executed first.