[]Struct bevy::core::prelude::Timer

pub struct Timer { /* fields omitted */ }

Tracks elapsed time. Enters the finished state once duration is reached.

Non repeating timers will stop tracking and stay in the finished state until reset. Repeating timers will only be in the finished state on each tick duration is reached or exceeded, and can still be reset at any given point.

Paused timers will not have elapsed time increased.

Implementations

impl Timer

pub fn new(duration: Duration, repeating: bool) -> Timer

pub fn from_seconds(seconds: f32, repeating: bool) -> Timer

pub fn pause(&mut self)

pub fn unpause(&mut self)

pub fn paused(&self) -> bool

pub fn elapsed(&self) -> f32

Returns the time elapsed on the timer. Guaranteed to be between 0.0 and duration, inclusive.

pub fn set_elapsed(&mut self, elapsed: f32)

pub fn duration(&self) -> f32

pub fn set_duration(&mut self, duration: f32)

pub fn finished(&self) -> bool

Returns the finished state of the timer.

Non repeating timers will stop tracking and stay in the finished state until reset. Repeating timers will only be in the finished state on each tick duration is reached or exceeded, and can still be reset at any given point.

pub fn just_finished(&self) -> bool

Will only be true on the tick the timer's duration is reached or exceeded.

pub fn repeating(&self) -> bool

pub fn set_repeating(&mut self, repeating: bool)

pub fn tick(&mut self, delta: f32) -> &Timer

Advances the timer by delta seconds.

pub fn reset(&mut self)

pub fn percent(&self) -> f32

Percent timer has elapsed (goes from 0.0 to 1.0)

pub fn percent_left(&self) -> f32

Percent left on timer (goes from 1.0 to 0.0)

Trait Implementations

impl Clone for Timer

impl Debug for Timer

impl Default for Timer

impl GetTypeRegistration for Timer

impl Reflect for Timer

impl Struct for Timer

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Clone + Any

impl<T> Component for T where
    T: 'static + Send + Sync

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<T> From<T> for T[src]

impl<T> FromResources for T where
    T: Default

impl<S> GetField for S where
    S: Struct

impl<T> GetPath for T where
    T: Reflect

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Resource for T where
    T: 'static + Send + Sync

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> TypeData for T where
    T: 'static + Send + Sync + Clone

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,