EntityTrigger

Trait EntityTrigger 

Source
pub trait EntityTrigger:
    'static
    + Send
    + Sync {
    type Out: TriggerOut;

    // Required methods
    fn init(&mut self, world: &mut World);
    fn check(&mut self, entity: Entity, world: &World) -> Result<Self::Out>;
}
Expand description

Types that implement this may be used in StateMachines to transition from one state to another. Look at an example for implementing this trait, since it can be tricky.

Required Associated Types§

Source

type Out: TriggerOut

The trigger’s output. See TriggerOut.

Required Methods§

Source

fn init(&mut self, world: &mut World)

Initializes/resets this trigger. Runs every time the state machine transitions.

Source

fn check(&mut self, entity: Entity, world: &World) -> Result<Self::Out>

Checks whether the state machine should transition

Trait Implementations§

Source§

impl<O: 'static + TriggerOut> EntityTrigger for Box<dyn EntityTrigger<Out = O>>

Source§

type Out = O

The trigger’s output. See TriggerOut.
Source§

fn init(&mut self, world: &mut World)

Initializes/resets this trigger. Runs every time the state machine transitions.
Source§

fn check(&mut self, entity: Entity, world: &World) -> Result<Self::Out>

Checks whether the state machine should transition

Implementations on Foreign Types§

Source§

impl<O: 'static + TriggerOut> EntityTrigger for Box<dyn EntityTrigger<Out = O>>

Source§

type Out = O

Source§

fn init(&mut self, world: &mut World)

Source§

fn check(&mut self, entity: Entity, world: &World) -> Result<Self::Out>

Implementors§