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:
Hennadii Chernyshchyk 2022-10-30 16:02:31 +00:00
parent aa8c74591b
commit 75403289b2
2 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ use bevy_utils::Duration;
/// assert!(stopwatch.paused());
/// 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))]
#[reflect(Default)]
pub struct Stopwatch {

View File

@ -9,7 +9,7 @@ use bevy_utils::Duration;
/// exceeded, and can still be reset at any given point.
///
/// 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))]
#[reflect(Default)]
pub struct Timer {
@ -403,7 +403,7 @@ impl Timer {
}
/// 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))]
#[reflect(Default)]
pub enum TimerMode {