Implement basic player plugin
This commit is contained in:
parent
6705870f81
commit
bc5eb9b006
@ -1,2 +1,4 @@
|
|||||||
|
use crate::prelude::*;
|
||||||
|
|
||||||
pub struct Name(pub String);
|
pub struct Name(pub String);
|
||||||
pub struct Player;
|
pub struct Player;
|
||||||
|
15
src/main.rs
15
src/main.rs
@ -1,12 +1,19 @@
|
|||||||
mod components;
|
mod components;
|
||||||
|
mod plugins;
|
||||||
mod systems;
|
mod systems;
|
||||||
|
|
||||||
use bevy::prelude::*;
|
mod prelude {
|
||||||
use systems::*;
|
pub use crate::components::*;
|
||||||
|
pub use crate::plugins::*;
|
||||||
|
pub use crate::systems::*;
|
||||||
|
pub use bevy::prelude::*;
|
||||||
|
}
|
||||||
|
|
||||||
|
use prelude::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::build()
|
App::build()
|
||||||
.add_startup_system(add_player.system())
|
.add_plugins(DefaultPlugins)
|
||||||
.add_system(greet_player.system())
|
.add_plugin(PlayerPlugin)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
10
src/plugins/mod.rs
Normal file
10
src/plugins/mod.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
use crate::prelude::*;
|
||||||
|
|
||||||
|
pub struct PlayerPlugin;
|
||||||
|
|
||||||
|
impl Plugin for PlayerPlugin {
|
||||||
|
fn build(&self, app: &mut AppBuilder) {
|
||||||
|
app.add_startup_system(add_player.system())
|
||||||
|
.add_system(greet_player.system());
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
use crate::components::{Name, Player};
|
use crate::prelude::*;
|
||||||
use bevy::prelude::*;
|
|
||||||
|
|
||||||
pub fn add_player(mut commands: Commands) {
|
pub fn add_player(mut commands: Commands) {
|
||||||
commands
|
commands
|
||||||
|
Loading…
Reference in New Issue
Block a user