Trait bevy_bulletml::AppRunner
source · [−]pub trait AppRunner<D, B: Component> {
Show 17 methods
fn get_bullet_direction(&self, data: &D, bullet: &B) -> f64;
fn get_aim_direction(
&self,
data: &D,
bullet_position: &Vec3,
target_position: &Vec3
) -> f64;
fn get_bullet_speed(&self, data: &D, bullet: &B) -> f64;
fn get_default_speed(&self) -> f64;
fn get_rank(&self, data: &D) -> f64;
fn create_simple_bullet(
&mut self,
data: &mut D,
direction: f64,
speed: f64,
bullet_position: &Vec3,
commands: &mut Commands<'_, '_>
);
fn create_bullet(
&mut self,
data: &mut D,
state: State,
direction: f64,
speed: f64,
bullet_position: &Vec3,
commands: &mut Commands<'_, '_>
);
fn get_turn(&self, data: &D) -> u32;
fn do_vanish(&mut self, data: &mut D, bullet: &mut B);
fn get_rand(&self, data: &mut D) -> f64;
fn init(&mut self) { ... }
fn do_change_direction(
&mut self,
_data: &mut D,
_direction: f64,
_bullet: &mut B
) { ... }
fn do_change_speed(&mut self, _data: &mut D, _speed: f64, _bullet: &mut B) { ... }
fn do_accel_x(&mut self, _: f64, _bullet: &mut B) { ... }
fn do_accel_y(&mut self, _: f64, _bullet: &mut B) { ... }
fn get_bullet_speed_x(&self, _bullet: &B) -> f64 { ... }
fn get_bullet_speed_y(&self, _bullet: &B) -> f64 { ... }
}
Expand description
Application specific BulletML runner trait.
Required Methods
fn get_bullet_direction(&self, data: &D, bullet: &B) -> f64
fn get_bullet_direction(&self, data: &D, bullet: &B) -> f64
Gets this bullet’s direction based on application data.
Gets this bullet’s aim direction based on application data.
The “target” related to the “aim” notion is application specific.
fn get_bullet_speed(&self, data: &D, bullet: &B) -> f64
fn get_bullet_speed(&self, data: &D, bullet: &B) -> f64
Gets this bullet’s speed based on application data.
fn get_default_speed(&self) -> f64
fn get_default_speed(&self) -> f64
Gets the bullet default speed.
Gets the BulletML “rank”, a value between 0 and 1 indicating the level of difficulty.
The value is used in arithmetic expressions with $rank
.
Tells the application to create a bullet with the given direction
and speed
.
The simple use case is to create a bullet whose direction and speed won’t change until it disappears or hits the target.
Nevertheless there could be more complex use cases which involve creating a new runner with the same BulletML document or even another one.
Tells the application to create a bullet based on the given state
, initial direction
and initial speed
.
The typical use case is to create a new runner with the same BulletML document. See Runner::new_from_state and Runner::init_from_state.
Tells the application to make this bullet vanish.
Provided Methods
Initializes the runner.
This function is called when a new Runner is created/reused.
fn do_change_direction(&mut self, _data: &mut D, _direction: f64, _bullet: &mut B)
fn do_change_speed(&mut self, _data: &mut D, _speed: f64, _bullet: &mut B)
fn do_change_speed(&mut self, _data: &mut D, _speed: f64, _bullet: &mut B)
Tells the application to make this bullet change speed.
fn do_accel_x(&mut self, _: f64, _bullet: &mut B)
fn do_accel_x(&mut self, _: f64, _bullet: &mut B)
Tells the application to make this bullet accelerate.
fn do_accel_y(&mut self, _: f64, _bullet: &mut B)
fn do_accel_y(&mut self, _: f64, _bullet: &mut B)
Tells the application to make this bullet accelerate.
fn get_bullet_speed_x(&self, _bullet: &B) -> f64
fn get_bullet_speed_x(&self, _bullet: &B) -> f64
Gets this bullet’s X speed.
fn get_bullet_speed_y(&self, _bullet: &B) -> f64
fn get_bullet_speed_y(&self, _bullet: &B) -> f64
Gets this bullet’s Y speed.