From 3c226bb064284ae6db15047c9bc5fa46e45695f7 Mon Sep 17 00:00:00 2001 From: rewin Date: Thu, 7 Dec 2023 22:26:11 +0300 Subject: [PATCH] cargo fmt --- src/level_ui.rs | 44 +++++++++++------------ src/lib.rs | 4 +-- src/sheep.rs | 2 +- src/storyteller.rs | 90 +++++++++++++++++++++++----------------------- src/test_level.rs | 6 ++-- 5 files changed, 72 insertions(+), 74 deletions(-) diff --git a/src/level_ui.rs b/src/level_ui.rs index 3c40e71..074b554 100644 --- a/src/level_ui.rs +++ b/src/level_ui.rs @@ -30,30 +30,30 @@ fn create_level_ui_system( text_style.font_size = 24.0; //Spawn top info bar - commands.spawn((NodeBundle { - style: Style { - width: Val::Percent(100.0), - height: Val::Px(50.0), - flex_direction: FlexDirection::Row, - justify_content: JustifyContent::Center, - align_items: AlignItems::Center, - - align_self: AlignSelf::Stretch, + commands + .spawn(( + NodeBundle { + style: Style { + width: Val::Percent(100.0), + height: Val::Px(50.0), + flex_direction: FlexDirection::Row, + justify_content: JustifyContent::Center, + align_items: AlignItems::Center, + + align_self: AlignSelf::Stretch, + ..default() + }, ..default() }, - ..default() - }, - LevelUi - )).with_children(|parent| { - parent.spawn(( - TextBundle::from_section( - "", - text_style.clone() - ), LevelUi, - LevelTimer - )); - }); + )) + .with_children(|parent| { + parent.spawn(( + TextBundle::from_section("", text_style.clone()), + LevelUi, + LevelTimer, + )); + }); ev_create_level_ui.clear(); -} \ No newline at end of file +} diff --git a/src/lib.rs b/src/lib.rs index 43e1731..e777c26 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,15 +2,15 @@ pub mod common_storage; pub mod debug_diagnostic; +pub mod level_ui; pub mod physics; pub mod player; pub mod safe_area; pub mod sheep; pub mod sprite_material; +pub mod storyteller; pub mod test_level; pub mod torch; -pub mod storyteller; -pub mod level_ui; use std::f32::consts::PI; diff --git a/src/sheep.rs b/src/sheep.rs index 11aa070..f84b39e 100644 --- a/src/sheep.rs +++ b/src/sheep.rs @@ -49,7 +49,7 @@ impl Plugin for SheepPlugin { //random walk app.add_event::() - .add_systems(Update, (init_random_walk, )); + .add_systems(Update, (init_random_walk,)); app.add_systems(Update, (goto_system,)); diff --git a/src/storyteller.rs b/src/storyteller.rs index 3ee62f2..2602b79 100644 --- a/src/storyteller.rs +++ b/src/storyteller.rs @@ -1,74 +1,73 @@ //This global AI is responsible for creating problems for player //This module will be determine where and how sheep will be try to escape from safe zone -use std::{f32::consts::{PI, E}, time::Duration}; +use std::{ + f32::consts::{E, PI}, + time::Duration, +}; use bevy::prelude::*; use rand::Rng; -use crate::{sheep::{Sheep, SHEEP_SPEED, RANDOM_WALK_SPEED_MULTIPLIER, GoTo}, test_level::LevelSize, player::DOG_SPEED}; +use crate::{ + player::DOG_SPEED, + sheep::{GoTo, Sheep, RANDOM_WALK_SPEED_MULTIPLIER, SHEEP_SPEED}, + test_level::LevelSize, +}; pub struct StorytellerPlugin; impl Plugin for StorytellerPlugin { fn build(&self, app: &mut App) { - app - .insert_resource(Storyteller { - level_start_time : 0.0, - level_duration : 4.0 * 60.0, - next_wave : None - }) - .add_systems(Update, ( - storyteller_system, - level_timer - )) - .add_systems(PostStartup, setup_start_time); + app.insert_resource(Storyteller { + level_start_time: 0.0, + level_duration: 4.0 * 60.0, + next_wave: None, + }) + .add_systems(Update, (storyteller_system, level_timer)) + .add_systems(PostStartup, setup_start_time); } } #[derive(Debug, Clone)] pub struct SheepWave { - pub count : usize, - pub beams : usize, - pub time : f32 + pub count: usize, + pub beams: usize, + pub time: f32, } #[derive(Resource)] pub struct Storyteller { - pub level_start_time : f32, - pub level_duration : f32, - pub next_wave : Option + pub level_start_time: f32, + pub level_duration: f32, + pub next_wave: Option, } -fn setup_start_time( - mut teller : ResMut, - time : Res