From 816d0c9bdd9e6d1022c5654ffdef186d73c02d5c Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Tue, 3 Dec 2019 00:30:30 -0800 Subject: [PATCH] wander spawner --- Cargo.toml | 3 +- examples/simple.rs | 189 +++++++++++++++++++++++++++++++++------ src/application.rs | 70 +++++++-------- src/asset/mod.rs | 28 +++++- src/core/mod.rs | 3 + src/core/time.rs | 26 ++++++ src/render/shadow/mod.rs | 30 ++++++- tiny-town/README.md | 3 +- 8 files changed, 279 insertions(+), 73 deletions(-) create mode 100644 src/core/time.rs diff --git a/Cargo.toml b/Cargo.toml index eb8e53b035..48a24c66d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,4 +13,5 @@ winit = "0.20.0-alpha4" glsl-to-spirv = "0.1" zerocopy = "0.2" log = "0.4" -env_logger = "0.7" \ No newline at end of file +env_logger = "0.7" +rand = "0.7.2" \ No newline at end of file diff --git a/examples/simple.rs b/examples/simple.rs index b95ebe4643..3d2a1adc62 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -1,28 +1,149 @@ use bevy::*; -use bevy::{render::*, asset::{Asset, AssetStorage}, math}; +use bevy::{render::*, asset::{Asset, AssetStorage, Handle}, math, Schedulable}; +use rand::{rngs::StdRng, Rng, SeedableRng, random}; -// fn build_move_system() -> Box { -// SystemBuilder::new("MoveSystem") -// .with_query(<>) -// } +fn build_wander_system(world: &mut World) -> Box { + let mut rng = StdRng::from_entropy(); + + SystemBuilder::new("Wander") + .read_resource::