pub struct FeedbackEvent {
pub kind: FeedbackKind,
pub intensity: f32,
pub position: Vec3,
}Fields§
§kind: FeedbackKind§intensity: f32§position: Vec3Implementations§
Source§impl FeedbackEvent
impl FeedbackEvent
Sourcepub fn new(
kind: FeedbackKind,
position: Vec3,
intensity: f32,
) -> Result<FeedbackEvent, FeedbackError>
pub fn new( kind: FeedbackKind, position: Vec3, intensity: f32, ) -> Result<FeedbackEvent, FeedbackError>
Creates an event with finite position and intensity in 0..=4.
Intensity scales the authored event, including its sound; use
FeedbackPolicy to reduce visuals without changing sound.
use ferravex_math::Vec3;
use ferravex_play::feedback::{FeedbackEvent, FeedbackKind};
let event = FeedbackEvent::new(FeedbackKind::Hit, Vec3::ZERO, 0.5).unwrap();
assert_eq!(event.intensity, 0.5);
assert!(FeedbackEvent::hurt(Vec3::ZERO, f32::NAN).is_err());Sourcepub fn fire(
position: Vec3,
intensity: f32,
) -> Result<FeedbackEvent, FeedbackError>
pub fn fire( position: Vec3, intensity: f32, ) -> Result<FeedbackEvent, FeedbackError>
Checked feedback for a fired shot. Call after ammo/cooldown acceptance.
Sourcepub fn hit(
position: Vec3,
intensity: f32,
) -> Result<FeedbackEvent, FeedbackError>
pub fn hit( position: Vec3, intensity: f32, ) -> Result<FeedbackEvent, FeedbackError>
Checked feedback for a confirmed hit, rather than an attempted attack.
Sourcepub fn hurt(
position: Vec3,
intensity: f32,
) -> Result<FeedbackEvent, FeedbackError>
pub fn hurt( position: Vec3, intensity: f32, ) -> Result<FeedbackEvent, FeedbackError>
Checked feedback for damage actually received.
Sourcepub fn land(
position: Vec3,
intensity: f32,
) -> Result<FeedbackEvent, FeedbackError>
pub fn land( position: Vec3, intensity: f32, ) -> Result<FeedbackEvent, FeedbackError>
Checked feedback for the transition from airborne to grounded.
Sourcepub fn dash(
position: Vec3,
intensity: f32,
) -> Result<FeedbackEvent, FeedbackError>
pub fn dash( position: Vec3, intensity: f32, ) -> Result<FeedbackEvent, FeedbackError>
Checked feedback for a dash accepted by the movement rules.
Sourcepub fn pickup(
position: Vec3,
intensity: f32,
) -> Result<FeedbackEvent, FeedbackError>
pub fn pickup( position: Vec3, intensity: f32, ) -> Result<FeedbackEvent, FeedbackError>
Checked feedback for an item actually collected.
Sourcepub fn explosion(
position: Vec3,
intensity: f32,
) -> Result<FeedbackEvent, FeedbackError>
pub fn explosion( position: Vec3, intensity: f32, ) -> Result<FeedbackEvent, FeedbackError>
Checked feedback for a confirmed explosion.
Trait Implementations§
Source§impl Clone for FeedbackEvent
impl Clone for FeedbackEvent
Source§fn clone(&self) -> FeedbackEvent
fn clone(&self) -> FeedbackEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FeedbackEvent
impl Debug for FeedbackEvent
impl Copy for FeedbackEvent
Auto Trait Implementations§
impl Freeze for FeedbackEvent
impl RefUnwindSafe for FeedbackEvent
impl Send for FeedbackEvent
impl Sync for FeedbackEvent
impl Unpin for FeedbackEvent
impl UnwindSafe for FeedbackEvent
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