2022-07-10 20:29:06 +00:00
|
|
|
use bevy_ecs::prelude::Entity;
|
|
|
|
|
2022-09-26 21:47:31 +00:00
|
|
|
/// An [`Event`] that is fired whenever there is a change in the world's hierarchy.
|
2022-07-10 20:29:06 +00:00
|
|
|
///
|
|
|
|
/// [`Event`]: bevy_ecs::event::Event
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub enum HierarchyEvent {
|
2022-09-26 21:47:31 +00:00
|
|
|
/// Fired whenever an [`Entity`] is added as a child to a parent.
|
2022-07-10 20:29:06 +00:00
|
|
|
ChildAdded {
|
2022-09-26 21:47:31 +00:00
|
|
|
/// The child that was added
|
2022-07-10 20:29:06 +00:00
|
|
|
child: Entity,
|
|
|
|
/// The parent the child was added to
|
|
|
|
parent: Entity,
|
|
|
|
},
|
2022-09-26 21:47:31 +00:00
|
|
|
/// Fired whenever a child [`Entity`] is removed from its parent.
|
2022-07-10 20:29:06 +00:00
|
|
|
ChildRemoved {
|
2022-09-26 21:47:31 +00:00
|
|
|
/// The child that was removed
|
2022-07-10 20:29:06 +00:00
|
|
|
child: Entity,
|
|
|
|
/// The parent the child was removed from
|
|
|
|
parent: Entity,
|
|
|
|
},
|
2022-09-26 21:47:31 +00:00
|
|
|
/// Fired whenever a child [`Entity`] is moved to a new parent.
|
2022-07-10 20:29:06 +00:00
|
|
|
ChildMoved {
|
2022-09-26 21:47:31 +00:00
|
|
|
/// The child that was moved
|
2022-07-10 20:29:06 +00:00
|
|
|
child: Entity,
|
|
|
|
/// The parent the child was removed from
|
|
|
|
previous_parent: Entity,
|
|
|
|
/// The parent the child was added to
|
|
|
|
new_parent: Entity,
|
|
|
|
},
|
|
|
|
}
|