Switch to replicon (#80)
This commit is contained in:
17
crates/shared/src/tick.rs
Normal file
17
crates/shared/src/tick.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use crate::GameState;
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub fn plugin(app: &mut App) {
|
||||
app.init_resource::<GameTick>();
|
||||
|
||||
app.add_systems(
|
||||
FixedLast,
|
||||
(|mut tick: ResMut<GameTick>| {
|
||||
tick.0 += 1;
|
||||
})
|
||||
.run_if(in_state(GameState::Playing)),
|
||||
);
|
||||
}
|
||||
|
||||
#[derive(Default, Resource)]
|
||||
pub struct GameTick(pub u64);
|
||||
Reference in New Issue
Block a user