Add FromReflect for Timer (#6422)
# Objective - Time have `Reflect`, but doesn't have `FromReflect`. ## Solution - Add it for `Timer`, `Stopwatch` and `TimerMode`. --- ## Changelog ### Added * `FromReflect` derive for `Timer`, `Stopwatch` and `TimerMode`.
This commit is contained in:
parent
aa8c74591b
commit
75403289b2
@ -23,7 +23,7 @@ use bevy_utils::Duration;
|
|||||||
/// assert!(stopwatch.paused());
|
/// assert!(stopwatch.paused());
|
||||||
/// assert_eq!(stopwatch.elapsed_secs(), 0.0);
|
/// assert_eq!(stopwatch.elapsed_secs(), 0.0);
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, Debug, Default, Reflect)]
|
#[derive(Clone, Debug, Default, Reflect, FromReflect)]
|
||||||
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
|
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
|
||||||
#[reflect(Default)]
|
#[reflect(Default)]
|
||||||
pub struct Stopwatch {
|
pub struct Stopwatch {
|
||||||
|
|||||||
@ -9,7 +9,7 @@ use bevy_utils::Duration;
|
|||||||
/// exceeded, and can still be reset at any given point.
|
/// exceeded, and can still be reset at any given point.
|
||||||
///
|
///
|
||||||
/// Paused timers will not have elapsed time increased.
|
/// Paused timers will not have elapsed time increased.
|
||||||
#[derive(Clone, Debug, Default, Reflect)]
|
#[derive(Clone, Debug, Default, Reflect, FromReflect)]
|
||||||
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
|
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
|
||||||
#[reflect(Default)]
|
#[reflect(Default)]
|
||||||
pub struct Timer {
|
pub struct Timer {
|
||||||
@ -403,7 +403,7 @@ impl Timer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Specifies [`Timer`] behavior.
|
/// Specifies [`Timer`] behavior.
|
||||||
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, Reflect)]
|
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, Reflect, FromReflect)]
|
||||||
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
|
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
|
||||||
#[reflect(Default)]
|
#[reflect(Default)]
|
||||||
pub enum TimerMode {
|
pub enum TimerMode {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user