cherry-pick actiondebuginstant change from main
This commit is contained in:
parent
5378aef653
commit
9c196861a2
2 changed files with 13 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
use std::time::Instant;
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use bevy::{
|
use bevy::{
|
||||||
prelude::{Component, ReflectResource, Resource, Vec3},
|
prelude::{Component, ReflectResource, Resource, Vec3},
|
||||||
|
@ -14,6 +14,16 @@ impl Default for ActionDebugInstant {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ActionDebugInstant {
|
||||||
|
pub fn reset(&mut self) {
|
||||||
|
self.0 = Instant::now();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn elapsed(&self) -> Duration {
|
||||||
|
self.0.elapsed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Component)]
|
#[derive(Debug, Component)]
|
||||||
pub(super) struct Tunneling {
|
pub(super) struct Tunneling {
|
||||||
pub frames: usize,
|
pub frames: usize,
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
#[cfg(feature = "inspector")]
|
|
||||||
use std::time::Instant;
|
|
||||||
|
|
||||||
use bevy::prelude::{
|
use bevy::prelude::{
|
||||||
Commands, Entity, Quat, Query, Res, ResMut, Time, Transform, Vec3, With, Without,
|
Commands, Entity, Quat, Query, Res, ResMut, Time, Transform, Vec3, With, Without,
|
||||||
|
@ -73,10 +71,9 @@ pub(super) fn falling_cat(
|
||||||
|
|
||||||
#[cfg(feature = "inspector")]
|
#[cfg(feature = "inspector")]
|
||||||
{
|
{
|
||||||
let now = Instant::now();
|
if debug_instant.elapsed().as_millis() > 1000 {
|
||||||
if (now - debug_instant.0).as_millis() > 1000 {
|
|
||||||
dbg!(&control_vars, mag);
|
dbg!(&control_vars, mag);
|
||||||
debug_instant.0 = now;
|
debug_instant.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
control_vars.decay();
|
control_vars.decay();
|
||||||
|
|
Loading…
Reference in a new issue