pub struct CrushingWalls {Show 16 fields
pub left_wall_pos: f32,
pub right_wall_pos: f32,
pub left_start: f32,
pub right_start: f32,
pub close_speed: f32,
pub wall_height: f32,
pub wall_y: f32,
pub min_gap: f32,
pub damage_per_second: f32,
pub is_active: bool,
pub is_stopped: bool,
pub push_force: f32,
pub left_wall_id: Option<ObjectId>,
pub right_wall_id: Option<ObjectId>,
pub power_source_id: Option<ObjectId>,
pub power_source_health: f32,
}Expand description
Crushing walls trap.
Fields§
§left_wall_pos: f32§right_wall_pos: f32§left_start: f32§right_start: f32§close_speed: f32§wall_height: f32§wall_y: f32§min_gap: f32§damage_per_second: f32§is_active: bool§is_stopped: bool§push_force: f32§left_wall_id: Option<ObjectId>§right_wall_id: Option<ObjectId>§power_source_id: Option<ObjectId>§power_source_health: f32Implementations§
Source§impl CrushingWalls
impl CrushingWalls
pub fn new( left_x: f32, right_x: f32, wall_y: f32, wall_height: f32, damage: f32, ) -> Self
Sourcepub fn damage_power_source(&mut self, amount: f32) -> bool
pub fn damage_power_source(&mut self, amount: f32) -> bool
Damage the power source. Returns true if destroyed.
Sourcepub fn spawn(&mut self, world: &mut PhysicsWorld)
pub fn spawn(&mut self, world: &mut PhysicsWorld)
Spawn wall physics objects.
Sourcepub fn update(&mut self, dt: f32, world: &mut PhysicsWorld)
pub fn update(&mut self, dt: f32, world: &mut PhysicsWorld)
Update the crushing walls.
Sourcepub fn is_being_crushed(&self, point: Vec2) -> bool
pub fn is_being_crushed(&self, point: Vec2) -> bool
Check if a point is being crushed between the walls.
Sourcepub fn push_direction(&self, point: Vec2) -> Vec2
pub fn push_direction(&self, point: Vec2) -> Vec2
Get push direction for an entity between the walls.
Trait Implementations§
Source§impl Clone for CrushingWalls
impl Clone for CrushingWalls
Auto Trait Implementations§
impl Freeze for CrushingWalls
impl RefUnwindSafe for CrushingWalls
impl Send for CrushingWalls
impl Sync for CrushingWalls
impl Unpin for CrushingWalls
impl UnsafeUnpin for CrushingWalls
impl UnwindSafe for CrushingWalls
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.