2022-03-15 01:54:05 +00:00
|
|
|
#![warn(missing_docs)]
|
|
|
|
//! `bevy_hierarchy` can be used to define hierarchies of entities.
|
|
|
|
//!
|
|
|
|
//! Most commonly, these hierarchies are used for inheriting `Transform` values
|
|
|
|
//! from the [`Parent`] to its [`Children`].
|
|
|
|
|
|
|
|
mod components;
|
|
|
|
pub use components::*;
|
|
|
|
|
|
|
|
mod hierarchy;
|
|
|
|
pub use hierarchy::*;
|
|
|
|
|
|
|
|
mod child_builder;
|
|
|
|
pub use child_builder::*;
|
|
|
|
|
2022-07-10 20:29:06 +00:00
|
|
|
mod events;
|
|
|
|
pub use events::*;
|
2022-03-15 01:54:05 +00:00
|
|
|
|
2022-09-19 16:12:11 +00:00
|
|
|
mod valid_parent_check_plugin;
|
|
|
|
pub use valid_parent_check_plugin::*;
|
|
|
|
|
2022-10-31 15:57:50 +00:00
|
|
|
mod query_extension;
|
|
|
|
pub use query_extension::*;
|
|
|
|
|
2022-11-02 20:40:45 +00:00
|
|
|
#[doc(hidden)]
|
2022-03-15 01:54:05 +00:00
|
|
|
pub mod prelude {
|
2022-11-02 20:40:45 +00:00
|
|
|
#[doc(hidden)]
|
2022-09-19 16:12:11 +00:00
|
|
|
pub use crate::{
|
2022-10-31 15:57:50 +00:00
|
|
|
child_builder::*, components::*, hierarchy::*, query_extension::*, HierarchyPlugin,
|
|
|
|
ValidParentCheckPlugin,
|
2022-09-19 16:12:11 +00:00
|
|
|
};
|
2022-03-15 01:54:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
use bevy_app::prelude::*;
|
|
|
|
|
|
|
|
/// The base plugin for handling [`Parent`] and [`Children`] components
|
|
|
|
#[derive(Default)]
|
|
|
|
pub struct HierarchyPlugin;
|
|
|
|
|
|
|
|
impl Plugin for HierarchyPlugin {
|
|
|
|
fn build(&self, app: &mut App) {
|
|
|
|
app.register_type::<Children>()
|
|
|
|
.register_type::<Parent>()
|
2022-07-10 20:29:06 +00:00
|
|
|
.add_event::<HierarchyEvent>();
|
2022-03-15 01:54:05 +00:00
|
|
|
}
|
|
|
|
}
|