[][src]Trait myelin_engine::object::ObjectBehavior

pub trait ObjectBehavior: Debug + ObjectBehaviorClone {
    fn step(
        &mut self,
        own_description: &ObjectDescription,
        world_interactor: &dyn WorldInteractor
    ) -> Option<Action>;
fn as_any(&self) -> &dyn Any; }

Behavior of an object

Required methods

fn step(
    &mut self,
    own_description: &ObjectDescription,
    world_interactor: &dyn WorldInteractor
) -> Option<Action>

Returns all actions performed by the object in the current simulation tick

fn as_any(&self) -> &dyn Any

Cast implementation to Any. This is needed in order to downcast trait objects of type &dyn ObjectBehavior to concrete types.

Implement this as follows.

This example is not tested
fn as_any(&self) -> &Any {
   self
}

Additional information

Loading content...

Implementors

Loading content...