Scope GameObjects for automatic cleanup
This commit is contained in:
parent
f0d690a9f8
commit
4a097e7ed8
2 changed files with 4 additions and 1 deletions
|
@ -1,9 +1,11 @@
|
|||
use avian2d::prelude::*;
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::AppState;
|
||||
|
||||
/// Basic implementation of a physics object
|
||||
#[derive(Component, Default)]
|
||||
#[require(Collider, Mesh2d, MeshMaterial2d<ColorMaterial>, Restitution = Restitution::new(1.0), RigidBody, TransformInterpolation, Transform)]
|
||||
#[require(Collider, Mesh2d, MeshMaterial2d<ColorMaterial>, Restitution = Restitution::new(1.0), RigidBody, TransformInterpolation, Transform, StateScoped<AppState> = StateScoped(AppState::InGame))]
|
||||
struct GameObject;
|
||||
|
||||
/// Radius of a ball
|
||||
|
|
|
@ -40,6 +40,7 @@ struct Source {
|
|||
}
|
||||
|
||||
#[derive(States, Default, Debug, Clone, PartialEq, Eq, Hash)]
|
||||
#[states(scoped_entities)]
|
||||
enum AppState {
|
||||
#[default]
|
||||
Loading,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue