mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-17 00:13:17 +00:00
Remove tutorial stuff
This commit is contained in:
+1
-12
@@ -1,7 +1,6 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
mod orbit_cam;
|
||||
mod people;
|
||||
mod test_scene;
|
||||
|
||||
use orbit_cam::{OrbitCam, OrbitCamPlugin};
|
||||
@@ -12,21 +11,11 @@ fn main() {
|
||||
console_error_panic_hook::set_once();
|
||||
|
||||
App::new()
|
||||
.add_plugins((
|
||||
DefaultPlugins,
|
||||
people::Plugin,
|
||||
OrbitCamPlugin,
|
||||
TestScenePlugin,
|
||||
))
|
||||
.add_systems(Startup, hello_world)
|
||||
.add_plugins((DefaultPlugins, OrbitCamPlugin, TestScenePlugin))
|
||||
.add_systems(Update, draw_world_axes.after(orbit_cam::pan_orbit_camera))
|
||||
.run();
|
||||
}
|
||||
|
||||
fn hello_world() {
|
||||
info!("Hello, world!");
|
||||
}
|
||||
|
||||
fn draw_world_axes(mut gizmos: Gizmos, q: Query<&OrbitCam>) {
|
||||
let &OrbitCam { focus, radius, .. } = q.single();
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use bevy::{
|
||||
prelude::{
|
||||
info, App, Commands, Component, Query, Res, ResMut, Resource, Startup, Update, With,
|
||||
},
|
||||
time::{Time, TimerMode},
|
||||
};
|
||||
|
||||
pub struct Plugin;
|
||||
|
||||
impl bevy::app::Plugin for Plugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.insert_resource(Timer(bevy::time::Timer::from_seconds(
|
||||
2.0,
|
||||
TimerMode::Repeating,
|
||||
)))
|
||||
.add_systems(Startup, startup)
|
||||
.add_systems(Update, greet);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
struct Person;
|
||||
|
||||
#[derive(Component)]
|
||||
struct Name(String);
|
||||
|
||||
impl Name {
|
||||
fn new<S: Into<String>>(name: S) -> Self {
|
||||
Self(name.into())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Resource)]
|
||||
struct Timer(bevy::time::Timer);
|
||||
|
||||
impl Timer {
|
||||
fn tick(&mut self, delta: Duration) -> &bevy::time::Timer {
|
||||
self.0.tick(delta)
|
||||
}
|
||||
}
|
||||
|
||||
fn startup(mut cmds: Commands) {
|
||||
cmds.spawn((Person, Name::new("Elaina Proctor")));
|
||||
cmds.spawn((Person, Name::new("Renzo Hume")));
|
||||
cmds.spawn((Person, Name::new("Zayna Nieves")));
|
||||
}
|
||||
|
||||
fn greet(time: Res<Time>, mut timer: ResMut<Timer>, q: Query<&Name, With<Person>>) {
|
||||
if timer.tick(time.delta()).just_finished() {
|
||||
for name in &q {
|
||||
info!("Hello, {}!", name.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user