gamai 0.1.39

Modular task switching library suitable for Game AI and Robotics.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use bevy_derive::Deref;
use bevy_derive::DerefMut;
use bevy_ecs::prelude::*;
use petgraph::graph::DiGraph;
use serde::Deserialize;
use serde::Serialize;

#[derive(Debug, Clone, Deref, DerefMut, Serialize, Deserialize)]
pub struct EntityGraph(pub DiGraph<Entity, ()>);


impl EntityGraph {
	pub fn despawn(&self, commands: &mut Commands) {
		for entity in self.node_weights() {
			commands.entity(*entity).despawn();
		}
	}
}