chore(examples): updated examples for bevy 0.13
* updated dependencies * updated code where relevant * temporary removed editor * attempting to tweak lighting/camera proxies to match Bevy's new defaults * updated assets where relevant * still wip, as bevy_xpbd is not yet updated for 0.13 * all work except the above & save/load
This commit is contained in:
parent
cc2718ffd2
commit
3bc1a87d1e
|
@ -5,11 +5,8 @@ edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.12"
|
bevy="0.13"
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
|
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
|
||||||
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
|
|
||||||
bevy_editor_pls = { version = "0.6" }
|
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
|
|
@ -43,12 +43,12 @@ pub fn setup_game(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spawn_test(
|
pub fn spawn_test(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
|
||||||
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::T) {
|
if keycode.just_pressed(KeyCode::KeyT) {
|
||||||
let world = game_world.single_mut();
|
let world = game_world.single_mut();
|
||||||
let world = world.1[0];
|
let world = world.1[0];
|
||||||
|
|
||||||
|
@ -165,11 +165,11 @@ pub fn animation_control(
|
||||||
|
|
||||||
mut animation_players: Query<&mut AnimationPlayer>,
|
mut animation_players: Query<&mut AnimationPlayer>,
|
||||||
|
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
// mut entities_with_animations : Query<(&mut AnimationPlayer, &mut Animations)>,
|
// mut entities_with_animations : Query<(&mut AnimationPlayer, &mut Animations)>,
|
||||||
) {
|
) {
|
||||||
// robots
|
// robots
|
||||||
if keycode.just_pressed(KeyCode::B) {
|
if keycode.just_pressed(KeyCode::KeyB) {
|
||||||
for (link, animations) in animated_enemies.iter() {
|
for (link, animations) in animated_enemies.iter() {
|
||||||
let mut animation_player = animation_players.get_mut(link.0).unwrap();
|
let mut animation_player = animation_players.get_mut(link.0).unwrap();
|
||||||
let anim_name = "Scan";
|
let anim_name = "Scan";
|
||||||
|
@ -187,7 +187,7 @@ pub fn animation_control(
|
||||||
}
|
}
|
||||||
|
|
||||||
// foxes
|
// foxes
|
||||||
if keycode.just_pressed(KeyCode::W) {
|
if keycode.just_pressed(KeyCode::KeyW) {
|
||||||
for (link, animations) in animated_foxes.iter() {
|
for (link, animations) in animated_foxes.iter() {
|
||||||
let mut animation_player = animation_players.get_mut(link.0).unwrap();
|
let mut animation_player = animation_players.get_mut(link.0).unwrap();
|
||||||
let anim_name = "Walk";
|
let anim_name = "Walk";
|
||||||
|
@ -204,7 +204,7 @@ pub fn animation_control(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::X) {
|
if keycode.just_pressed(KeyCode::KeyX) {
|
||||||
for (link, animations) in animated_foxes.iter() {
|
for (link, animations) in animated_foxes.iter() {
|
||||||
let mut animation_player = animation_players.get_mut(link.0).unwrap();
|
let mut animation_player = animation_players.get_mut(link.0).unwrap();
|
||||||
let anim_name = "Run";
|
let anim_name = "Run";
|
||||||
|
@ -221,7 +221,7 @@ pub fn animation_control(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::C) {
|
if keycode.just_pressed(KeyCode::KeyC) {
|
||||||
for (link, animations) in animated_foxes.iter() {
|
for (link, animations) in animated_foxes.iter() {
|
||||||
let mut animation_player = animation_players.get_mut(link.0).unwrap();
|
let mut animation_player = animation_players.get_mut(link.0).unwrap();
|
||||||
let anim_name = "Survey";
|
let anim_name = "Survey";
|
||||||
|
|
|
@ -89,22 +89,10 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main_menu(
|
pub fn main_menu(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
|
|
||||||
mut next_app_state: ResMut<NextState<AppState>>,
|
mut next_app_state: ResMut<NextState<AppState>>,
|
||||||
// mut next_game_state: ResMut<NextState<GameState>>,
|
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::Return) {
|
if keycode.just_pressed(KeyCode::Enter) {
|
||||||
next_app_state.set(AppState::AppLoading);
|
next_app_state.set(AppState::AppLoading);
|
||||||
// next_game_state.set(GameState::None);
|
|
||||||
}
|
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::L) {
|
|
||||||
next_app_state.set(AppState::AppLoading);
|
|
||||||
// load_requested_events.send(LoadRequest { path: "toto".into() })
|
|
||||||
}
|
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::S) {
|
|
||||||
// save_requested_events.send(SaveRequest { path: "toto".into() })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_editor_pls::prelude::*;
|
|
||||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||||
|
|
||||||
mod core;
|
mod core;
|
||||||
|
@ -15,8 +14,6 @@ fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins((
|
.add_plugins((
|
||||||
DefaultPlugins.set(AssetPlugin::default()),
|
DefaultPlugins.set(AssetPlugin::default()),
|
||||||
// editor
|
|
||||||
EditorPlugin::default(),
|
|
||||||
// our custom plugins
|
// our custom plugins
|
||||||
CommonPlugin,
|
CommonPlugin,
|
||||||
CorePlugin, // reusable plugins
|
CorePlugin, // reusable plugins
|
||||||
|
|
|
@ -5,11 +5,8 @@ edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.12"
|
bevy="0.13"
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
|
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
|
||||||
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
|
|
||||||
bevy_editor_pls = { version = "0.6" }
|
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
|
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
|
||||||
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
|
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
|
||||||
|
|
||||||
use bevy_rapier3d::prelude::Velocity;
|
use bevy_rapier3d::prelude::Velocity;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
|
||||||
|
@ -40,12 +39,12 @@ pub fn setup_game(
|
||||||
struct UnregisteredComponent;
|
struct UnregisteredComponent;
|
||||||
|
|
||||||
pub fn spawn_test(
|
pub fn spawn_test(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
|
||||||
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::T) {
|
if keycode.just_pressed(KeyCode::KeyT) {
|
||||||
let world = game_world.single_mut();
|
let world = game_world.single_mut();
|
||||||
let world = world.1[0];
|
let world = world.1[0];
|
||||||
|
|
||||||
|
@ -83,12 +82,12 @@ pub fn spawn_test(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spawn_test_unregisted_components(
|
pub fn spawn_test_unregisted_components(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
|
||||||
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::U) {
|
if keycode.just_pressed(KeyCode::KeyU) {
|
||||||
let world = game_world.single_mut();
|
let world = game_world.single_mut();
|
||||||
let world = world.1[0];
|
let world = world.1[0];
|
||||||
|
|
||||||
|
|
|
@ -89,24 +89,24 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main_menu(
|
pub fn main_menu(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
|
|
||||||
mut next_app_state: ResMut<NextState<AppState>>,
|
mut next_app_state: ResMut<NextState<AppState>>,
|
||||||
// mut next_game_state: ResMut<NextState<GameState>>,
|
// mut next_game_state: ResMut<NextState<GameState>>,
|
||||||
// mut save_requested_events: EventWriter<SaveRequest>,
|
// mut save_requested_events: EventWriter<SaveRequest>,
|
||||||
// mut load_requested_events: EventWriter<LoadRequest>,
|
// mut load_requested_events: EventWriter<LoadRequest>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::Return) {
|
if keycode.just_pressed(KeyCode::Enter) {
|
||||||
next_app_state.set(AppState::AppLoading);
|
next_app_state.set(AppState::AppLoading);
|
||||||
// next_game_state.set(GameState::None);
|
// next_game_state.set(GameState::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::L) {
|
if keycode.just_pressed(KeyCode::KeyL) {
|
||||||
next_app_state.set(AppState::AppLoading);
|
next_app_state.set(AppState::AppLoading);
|
||||||
// load_requested_events.send(LoadRequest { path: "toto".into() })
|
// load_requested_events.send(LoadRequest { path: "toto".into() })
|
||||||
}
|
}
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::S) {
|
if keycode.just_pressed(KeyCode::KeyS) {
|
||||||
// save_requested_events.send(SaveRequest { path: "toto".into() })
|
// save_requested_events.send(SaveRequest { path: "toto".into() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_editor_pls::prelude::*;
|
|
||||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||||
|
|
||||||
mod core;
|
mod core;
|
||||||
|
@ -15,8 +14,6 @@ fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins((
|
.add_plugins((
|
||||||
DefaultPlugins.set(AssetPlugin::default()),
|
DefaultPlugins.set(AssetPlugin::default()),
|
||||||
// editor
|
|
||||||
EditorPlugin::default(),
|
|
||||||
// our custom plugins
|
// our custom plugins
|
||||||
CommonPlugin,
|
CommonPlugin,
|
||||||
CorePlugin, // reusable plugins
|
CorePlugin, // reusable plugins
|
||||||
|
|
|
@ -5,11 +5,6 @@ edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.12"
|
bevy="0.13"
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
|
|
||||||
bevy_xpbd_3d = "0.3"
|
|
||||||
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
|
|
||||||
bevy_editor_pls = { version = "0.6" }
|
|
||||||
rand = "0.8.5"
|
|
|
@ -5,11 +5,8 @@ edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.12"
|
bevy="0.13"
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
|
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
rand = "0.8.5"
|
||||||
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
|
|
||||||
bevy_editor_pls = { version = "0.6" }
|
|
||||||
rand = "0.8.5"
|
|
|
@ -41,12 +41,12 @@ pub fn setup_game(
|
||||||
struct UnregisteredComponent;
|
struct UnregisteredComponent;
|
||||||
|
|
||||||
pub fn spawn_test(
|
pub fn spawn_test(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
|
||||||
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::T) {
|
if keycode.just_pressed(KeyCode::KeyT) {
|
||||||
let world = game_world.single_mut();
|
let world = game_world.single_mut();
|
||||||
let world = world.1[0];
|
let world = world.1[0];
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ pub fn spawn_test(
|
||||||
let new_entity = commands
|
let new_entity = commands
|
||||||
.spawn((
|
.spawn((
|
||||||
BluePrintBundle {
|
BluePrintBundle {
|
||||||
blueprint: BlueprintName("Health_Pickup".to_string()),
|
blueprint: BlueprintName("Watermelon2".to_string()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
bevy::prelude::Name::from(format!("test{}", name_index)),
|
bevy::prelude::Name::from(format!("test{}", name_index)),
|
||||||
|
@ -81,48 +81,4 @@ pub fn spawn_test(
|
||||||
.id();
|
.id();
|
||||||
commands.entity(world).add_child(new_entity);
|
commands.entity(world).add_child(new_entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spawn_test_unregisted_components(
|
|
||||||
keycode: Res<Input<KeyCode>>,
|
|
||||||
mut commands: Commands,
|
|
||||||
|
|
||||||
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
|
||||||
) {
|
|
||||||
if keycode.just_pressed(KeyCode::U) {
|
|
||||||
let world = game_world.single_mut();
|
|
||||||
let world = world.1[0];
|
|
||||||
|
|
||||||
let mut rng = rand::thread_rng();
|
|
||||||
let range = 5.5;
|
|
||||||
let x: f32 = rng.gen_range(-range..range);
|
|
||||||
let y: f32 = rng.gen_range(-range..range);
|
|
||||||
|
|
||||||
let mut rng = rand::thread_rng();
|
|
||||||
let range = 0.8;
|
|
||||||
let vel_x: f32 = rng.gen_range(-range..range);
|
|
||||||
let vel_y: f32 = rng.gen_range(2.0..2.5);
|
|
||||||
let vel_z: f32 = rng.gen_range(-range..range);
|
|
||||||
|
|
||||||
let name_index: u64 = rng.gen();
|
|
||||||
|
|
||||||
let new_entity = commands
|
|
||||||
.spawn((
|
|
||||||
BluePrintBundle {
|
|
||||||
blueprint: BlueprintName("Health_Pickup".to_string()),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
bevy::prelude::Name::from(format!("test{}", name_index)),
|
|
||||||
// BlueprintName("Health_Pickup".to_string()),
|
|
||||||
// SpawnHere,
|
|
||||||
TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)),
|
|
||||||
Velocity {
|
|
||||||
linvel: Vec3::new(vel_x, vel_y, vel_z),
|
|
||||||
angvel: Vec3::new(0.0, 0.0, 0.0),
|
|
||||||
},
|
|
||||||
UnregisteredComponent,
|
|
||||||
))
|
|
||||||
.id();
|
|
||||||
commands.entity(world).add_child(new_entity);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -89,24 +89,11 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main_menu(
|
pub fn main_menu(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
|
|
||||||
mut next_app_state: ResMut<NextState<AppState>>,
|
mut next_app_state: ResMut<NextState<AppState>>,
|
||||||
// mut next_game_state: ResMut<NextState<GameState>>,
|
|
||||||
// mut save_requested_events: EventWriter<SaveRequest>,
|
|
||||||
// mut load_requested_events: EventWriter<LoadRequest>,
|
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::Return) {
|
if keycode.just_pressed(KeyCode::Enter) {
|
||||||
next_app_state.set(AppState::AppLoading);
|
next_app_state.set(AppState::AppLoading);
|
||||||
// next_game_state.set(GameState::None);
|
|
||||||
}
|
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::L) {
|
|
||||||
next_app_state.set(AppState::AppLoading);
|
|
||||||
// load_requested_events.send(LoadRequest { path: "toto".into() })
|
|
||||||
}
|
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::S) {
|
|
||||||
// save_requested_events.send(SaveRequest { path: "toto".into() })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ impl Plugin for GamePlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
Update,
|
Update,
|
||||||
(spawn_test, spawn_test_unregisted_components).run_if(in_state(GameState::InGame)),
|
(spawn_test).run_if(in_state(GameState::InGame)),
|
||||||
)
|
)
|
||||||
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
|
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
|
||||||
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
|
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_editor_pls::prelude::*;
|
|
||||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||||
|
|
||||||
mod core;
|
mod core;
|
||||||
|
@ -15,8 +14,6 @@ fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins((
|
.add_plugins((
|
||||||
DefaultPlugins.set(AssetPlugin::default()),
|
DefaultPlugins.set(AssetPlugin::default()),
|
||||||
// editor
|
|
||||||
EditorPlugin::default(),
|
|
||||||
// our custom plugins
|
// our custom plugins
|
||||||
CommonPlugin,
|
CommonPlugin,
|
||||||
CorePlugin, // reusable plugins
|
CorePlugin, // reusable plugins
|
||||||
|
|
|
@ -5,11 +5,8 @@ edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.12"
|
bevy="0.13"
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
|
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
rand = "0.8.5"
|
||||||
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
|
|
||||||
bevy_editor_pls = { version = "0.6" }
|
|
||||||
rand = "0.8.5"
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -41,12 +41,12 @@ pub fn setup_game(
|
||||||
struct UnregisteredComponent;
|
struct UnregisteredComponent;
|
||||||
|
|
||||||
pub fn spawn_test(
|
pub fn spawn_test(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
|
||||||
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::T) {
|
if keycode.just_pressed(KeyCode::KeyT) {
|
||||||
let world = game_world.single_mut();
|
let world = game_world.single_mut();
|
||||||
let world = world.1[0];
|
let world = world.1[0];
|
||||||
|
|
||||||
|
@ -82,47 +82,3 @@ pub fn spawn_test(
|
||||||
commands.entity(world).add_child(new_entity);
|
commands.entity(world).add_child(new_entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spawn_test_unregisted_components(
|
|
||||||
keycode: Res<Input<KeyCode>>,
|
|
||||||
mut commands: Commands,
|
|
||||||
|
|
||||||
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
|
||||||
) {
|
|
||||||
if keycode.just_pressed(KeyCode::U) {
|
|
||||||
let world = game_world.single_mut();
|
|
||||||
let world = world.1[0];
|
|
||||||
|
|
||||||
let mut rng = rand::thread_rng();
|
|
||||||
let range = 5.5;
|
|
||||||
let x: f32 = rng.gen_range(-range..range);
|
|
||||||
let y: f32 = rng.gen_range(-range..range);
|
|
||||||
|
|
||||||
let mut rng = rand::thread_rng();
|
|
||||||
let range = 0.8;
|
|
||||||
let vel_x: f32 = rng.gen_range(-range..range);
|
|
||||||
let vel_y: f32 = rng.gen_range(2.0..2.5);
|
|
||||||
let vel_z: f32 = rng.gen_range(-range..range);
|
|
||||||
|
|
||||||
let name_index: u64 = rng.gen();
|
|
||||||
|
|
||||||
let new_entity = commands
|
|
||||||
.spawn((
|
|
||||||
BluePrintBundle {
|
|
||||||
blueprint: BlueprintName("Health_Pickup".to_string()),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
bevy::prelude::Name::from(format!("test{}", name_index)),
|
|
||||||
// BlueprintName("Health_Pickup".to_string()),
|
|
||||||
// SpawnHere,
|
|
||||||
TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)),
|
|
||||||
Velocity {
|
|
||||||
linvel: Vec3::new(vel_x, vel_y, vel_z),
|
|
||||||
angvel: Vec3::new(0.0, 0.0, 0.0),
|
|
||||||
},
|
|
||||||
UnregisteredComponent,
|
|
||||||
))
|
|
||||||
.id();
|
|
||||||
commands.entity(world).add_child(new_entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -89,24 +89,10 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main_menu(
|
pub fn main_menu(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
|
|
||||||
mut next_app_state: ResMut<NextState<AppState>>,
|
mut next_app_state: ResMut<NextState<AppState>>,
|
||||||
// mut next_game_state: ResMut<NextState<GameState>>,
|
|
||||||
// mut save_requested_events: EventWriter<SaveRequest>,
|
|
||||||
// mut load_requested_events: EventWriter<LoadRequest>,
|
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::Return) {
|
if keycode.just_pressed(KeyCode::Enter) {
|
||||||
next_app_state.set(AppState::AppLoading);
|
next_app_state.set(AppState::AppLoading);
|
||||||
// next_game_state.set(GameState::None);
|
|
||||||
}
|
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::L) {
|
|
||||||
next_app_state.set(AppState::AppLoading);
|
|
||||||
// load_requested_events.send(LoadRequest { path: "toto".into() })
|
|
||||||
}
|
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::S) {
|
|
||||||
// save_requested_events.send(SaveRequest { path: "toto".into() })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,9 @@ pub fn trigger_level_transition(
|
||||||
pub struct LevelsPlugin;
|
pub struct LevelsPlugin;
|
||||||
impl Plugin for LevelsPlugin {
|
impl Plugin for LevelsPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.register_type::<LevelTransition>().add_systems(
|
app
|
||||||
|
.register_type::<LevelTransition>()
|
||||||
|
.add_systems(
|
||||||
Update,
|
Update,
|
||||||
(trigger_level_transition,).run_if(in_state(GameState::InGame)),
|
(trigger_level_transition,).run_if(in_state(GameState::InGame)),
|
||||||
);
|
);
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl Plugin for GamePlugin {
|
||||||
app.add_plugins(LevelsPlugin)
|
app.add_plugins(LevelsPlugin)
|
||||||
.add_systems(
|
.add_systems(
|
||||||
Update,
|
Update,
|
||||||
(spawn_test, spawn_test_unregisted_components).run_if(in_state(GameState::InGame)),
|
(spawn_test).run_if(in_state(GameState::InGame)),
|
||||||
)
|
)
|
||||||
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
|
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
|
||||||
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
|
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_editor_pls::prelude::*;
|
|
||||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||||
|
|
||||||
mod core;
|
mod core;
|
||||||
|
@ -15,8 +14,6 @@ fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins((
|
.add_plugins((
|
||||||
DefaultPlugins.set(AssetPlugin::default()),
|
DefaultPlugins.set(AssetPlugin::default()),
|
||||||
// editor
|
|
||||||
EditorPlugin::default(),
|
|
||||||
// our custom plugins
|
// our custom plugins
|
||||||
CommonPlugin,
|
CommonPlugin,
|
||||||
CorePlugin, // reusable plugins
|
CorePlugin, // reusable plugins
|
||||||
|
|
|
@ -5,9 +5,6 @@ edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.12"
|
bevy="0.13"
|
||||||
bevy_gltf_components = { path = "../../../crates/bevy_gltf_components" }
|
bevy_gltf_components = { path = "../../../crates/bevy_gltf_components" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
|
|
||||||
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
|
||||||
bevy_editor_pls = { version = "0.6" }
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use bevy::{gltf::Gltf, prelude::*};
|
use bevy::{gltf::Gltf, prelude::*};
|
||||||
use bevy_editor_pls::prelude::*;
|
|
||||||
use bevy_gltf_components::ComponentsFromGltfPlugin;
|
use bevy_gltf_components::ComponentsFromGltfPlugin;
|
||||||
use bevy_gltf_worlflow_examples_common::CorePlugin;
|
use bevy_gltf_worlflow_examples_common::CorePlugin;
|
||||||
|
|
||||||
|
@ -61,14 +60,14 @@ fn main() {
|
||||||
.add_plugins((
|
.add_plugins((
|
||||||
DefaultPlugins.set(AssetPlugin::default()),
|
DefaultPlugins.set(AssetPlugin::default()),
|
||||||
// editor
|
// editor
|
||||||
EditorPlugin::default(),
|
// EditorPlugin::default(),
|
||||||
// physics
|
// physics
|
||||||
// our custom plugins
|
// our custom plugins
|
||||||
ComponentsFromGltfPlugin::default(),
|
ComponentsFromGltfPlugin::default(),
|
||||||
CorePlugin, // reusable plugins
|
CorePlugin, // reusable plugins
|
||||||
ComponentsTestPlugin, // Showcases different type of components /structs
|
ComponentsTestPlugin, // Showcases different type of components /structs
|
||||||
))
|
))
|
||||||
.add_state::<AppState>()
|
.init_state::<AppState>()
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(Update, (spawn_level.run_if(in_state(AppState::Loading)),))
|
.add_systems(Update, (spawn_level.run_if(in_state(AppState::Loading)),))
|
||||||
.run();
|
.run();
|
||||||
|
|
|
@ -5,14 +5,13 @@ edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.12"
|
bevy="0.13"
|
||||||
bevy_gltf_blueprints = "0.7"
|
#bevy_gltf_blueprints = "0.7"
|
||||||
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_save_load = { path = "../../../crates/bevy_gltf_save_load" }
|
bevy_gltf_save_load = { path = "../../../crates/bevy_gltf_save_load" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
|
|
||||||
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
|
||||||
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
|
|
||||||
bevy_editor_pls = { version = "0.6" }
|
|
||||||
rand = "0.8.5"
|
|
||||||
serde_json="1.0.108"
|
serde_json="1.0.108"
|
||||||
serde="1.0.193"
|
serde="1.0.193"
|
||||||
|
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
|
rand = "0.8.5"
|
|
@ -60,16 +60,16 @@ pub fn unload_world(mut commands: Commands, gameworlds: Query<Entity, With<GameW
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn should_reset(keycode: Res<Input<KeyCode>>) -> bool {
|
pub fn should_reset(keycode: Res<ButtonInput<KeyCode>>) -> bool {
|
||||||
keycode.just_pressed(KeyCode::N)
|
keycode.just_pressed(KeyCode::KeyN)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spawn_test(
|
pub fn spawn_test(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
mut dynamic_entities_world: Query<Entity, With<DynamicEntitiesRoot>>,
|
mut dynamic_entities_world: Query<Entity, With<DynamicEntitiesRoot>>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::T) {
|
if keycode.just_pressed(KeyCode::KeyT) {
|
||||||
let world = dynamic_entities_world.single_mut();
|
let world = dynamic_entities_world.single_mut();
|
||||||
|
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
|
@ -109,12 +109,12 @@ pub fn spawn_test(
|
||||||
struct UnregisteredComponent;
|
struct UnregisteredComponent;
|
||||||
|
|
||||||
pub fn spawn_test_unregisted_components(
|
pub fn spawn_test_unregisted_components(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
|
||||||
mut dynamic_entities_world: Query<Entity, With<DynamicEntitiesRoot>>,
|
mut dynamic_entities_world: Query<Entity, With<DynamicEntitiesRoot>>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::U) {
|
if keycode.just_pressed(KeyCode::KeyU) {
|
||||||
let world = dynamic_entities_world.single_mut();
|
let world = dynamic_entities_world.single_mut();
|
||||||
|
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
|
@ -152,13 +152,13 @@ pub fn spawn_test_unregisted_components(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spawn_test_parenting(
|
pub fn spawn_test_parenting(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
players: Query<Entity, With<Player>>,
|
players: Query<Entity, With<Player>>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
|
||||||
names: Query<(Entity, &Name)>,
|
names: Query<(Entity, &Name)>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::P) {
|
if keycode.just_pressed(KeyCode::KeyP) {
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
let range = 5.5;
|
let range = 5.5;
|
||||||
let x: f32 = rng.gen_range(-range..range);
|
let x: f32 = rng.gen_range(-range..range);
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
use bevy::{core_pipeline::clear_color::ClearColorConfig, prelude::*};
|
use bevy::{prelude::*};
|
||||||
use bevy_gltf_worlflow_examples_common::InGameLoading;
|
use bevy_gltf_worlflow_examples_common::InGameLoading;
|
||||||
|
|
||||||
pub fn setup_loading_screen(mut commands: Commands) {
|
pub fn setup_loading_screen(mut commands: Commands) {
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
Camera2dBundle {
|
Camera2dBundle {
|
||||||
camera_2d: Camera2d {
|
|
||||||
clear_color: ClearColorConfig::Custom(Color::BLACK),
|
|
||||||
},
|
|
||||||
camera: Camera {
|
camera: Camera {
|
||||||
|
clear_color: ClearColorConfig::Custom(Color::BLACK),
|
||||||
// renders after / on top of the main camera
|
// renders after / on top of the main camera
|
||||||
order: 2,
|
order: 2,
|
||||||
..default()
|
..default()
|
||||||
|
|
|
@ -92,24 +92,15 @@ pub fn teardown_main_menu(in_main_menu: Query<Entity, With<InMainMenu>>, mut com
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main_menu(
|
pub fn main_menu(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
|
|
||||||
mut next_app_state: ResMut<NextState<AppState>>,
|
mut next_app_state: ResMut<NextState<AppState>>,
|
||||||
// mut next_game_state: ResMut<NextState<GameState>>,
|
|
||||||
// mut save_requested_events: EventWriter<SaveRequest>,
|
|
||||||
// mut load_requested_events: EventWriter<LoadRequest>,
|
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::Return) {
|
if keycode.just_pressed(KeyCode::Enter) {
|
||||||
next_app_state.set(AppState::AppLoading);
|
next_app_state.set(AppState::AppLoading);
|
||||||
// next_game_state.set(GameState::None);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::L) {
|
if keycode.just_pressed(KeyCode::KeyL) {
|
||||||
next_app_state.set(AppState::AppLoading);
|
next_app_state.set(AppState::AppLoading);
|
||||||
// load_requested_events.send(LoadRequest { path: "toto".into() })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::S) {
|
|
||||||
// save_requested_events.send(SaveRequest { path: "toto".into() })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,19 +16,19 @@ use bevy_gltf_save_load::{LoadRequest, LoadingFinished, SaveRequest, SavingFinis
|
||||||
|
|
||||||
pub fn request_save(
|
pub fn request_save(
|
||||||
mut save_requests: EventWriter<SaveRequest>,
|
mut save_requests: EventWriter<SaveRequest>,
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
|
|
||||||
current_state: Res<State<GameState>>,
|
current_state: Res<State<GameState>>,
|
||||||
mut next_game_state: ResMut<NextState<GameState>>,
|
mut next_game_state: ResMut<NextState<GameState>>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::S)
|
if keycode.just_pressed(KeyCode::KeyS)
|
||||||
&& (current_state.get() != &GameState::InLoading)
|
&& (current_state.get() != &GameState::InLoading)
|
||||||
&& (current_state.get() != &GameState::InSaving)
|
&& (current_state.get() != &GameState::InSaving)
|
||||||
{
|
{
|
||||||
next_game_state.set(GameState::InSaving);
|
next_game_state.set(GameState::InSaving);
|
||||||
save_requests.send(SaveRequest {
|
save_requests.send(SaveRequest {
|
||||||
path: "save.scn.ron".into(),
|
path: "save.scn.ron".into(),
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,18 +43,18 @@ pub fn on_saving_finished(
|
||||||
|
|
||||||
pub fn request_load(
|
pub fn request_load(
|
||||||
mut load_requests: EventWriter<LoadRequest>,
|
mut load_requests: EventWriter<LoadRequest>,
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
current_state: Res<State<GameState>>,
|
current_state: Res<State<GameState>>,
|
||||||
mut next_game_state: ResMut<NextState<GameState>>,
|
mut next_game_state: ResMut<NextState<GameState>>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::L)
|
if keycode.just_pressed(KeyCode::KeyL)
|
||||||
&& (current_state.get() != &GameState::InLoading)
|
&& (current_state.get() != &GameState::InLoading)
|
||||||
&& (current_state.get() != &GameState::InSaving)
|
&& (current_state.get() != &GameState::InSaving)
|
||||||
{
|
{
|
||||||
next_game_state.set(GameState::InLoading);
|
next_game_state.set(GameState::InLoading);
|
||||||
load_requests.send(LoadRequest {
|
load_requests.send(LoadRequest {
|
||||||
path: "save.scn.ron".into(),
|
path: "save.scn.ron".into(),
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_editor_pls::prelude::*;
|
|
||||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||||
|
|
||||||
mod core;
|
mod core;
|
||||||
|
@ -15,8 +14,6 @@ fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins((
|
.add_plugins((
|
||||||
DefaultPlugins.set(AssetPlugin::default()),
|
DefaultPlugins.set(AssetPlugin::default()),
|
||||||
// editor
|
|
||||||
EditorPlugin::default(),
|
|
||||||
// our custom plugins
|
// our custom plugins
|
||||||
CommonPlugin,
|
CommonPlugin,
|
||||||
CorePlugin, // reusable plugins
|
CorePlugin, // reusable plugins
|
||||||
|
|
|
@ -5,12 +5,9 @@ edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.12"
|
bevy="0.13"
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_registry_export = { path = "../../../crates/bevy_registry_export" }
|
bevy_registry_export = { path = "../../../crates/bevy_registry_export" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
|
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
rand = "0.8.5"
|
||||||
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
|
|
||||||
bevy_editor_pls = { version = "0.6" }
|
|
||||||
rand = "0.8.5"
|
|
File diff suppressed because it is too large
Load Diff
|
@ -41,12 +41,12 @@ pub fn setup_game(
|
||||||
struct UnregisteredComponent;
|
struct UnregisteredComponent;
|
||||||
|
|
||||||
pub fn spawn_test(
|
pub fn spawn_test(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
|
||||||
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::T) {
|
if keycode.just_pressed(KeyCode::KeyT) {
|
||||||
let world = game_world.single_mut();
|
let world = game_world.single_mut();
|
||||||
let world = world.1[0];
|
let world = world.1[0];
|
||||||
|
|
||||||
|
@ -81,48 +81,4 @@ pub fn spawn_test(
|
||||||
.id();
|
.id();
|
||||||
commands.entity(world).add_child(new_entity);
|
commands.entity(world).add_child(new_entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn spawn_test_unregisted_components(
|
|
||||||
keycode: Res<Input<KeyCode>>,
|
|
||||||
mut commands: Commands,
|
|
||||||
|
|
||||||
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
|
|
||||||
) {
|
|
||||||
if keycode.just_pressed(KeyCode::U) {
|
|
||||||
let world = game_world.single_mut();
|
|
||||||
let world = world.1[0];
|
|
||||||
|
|
||||||
let mut rng = rand::thread_rng();
|
|
||||||
let range = 5.5;
|
|
||||||
let x: f32 = rng.gen_range(-range..range);
|
|
||||||
let y: f32 = rng.gen_range(-range..range);
|
|
||||||
|
|
||||||
let mut rng = rand::thread_rng();
|
|
||||||
let range = 0.8;
|
|
||||||
let vel_x: f32 = rng.gen_range(-range..range);
|
|
||||||
let vel_y: f32 = rng.gen_range(2.0..2.5);
|
|
||||||
let vel_z: f32 = rng.gen_range(-range..range);
|
|
||||||
|
|
||||||
let name_index: u64 = rng.gen();
|
|
||||||
|
|
||||||
let new_entity = commands
|
|
||||||
.spawn((
|
|
||||||
BluePrintBundle {
|
|
||||||
blueprint: BlueprintName("Health_Pickup".to_string()),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
bevy::prelude::Name::from(format!("test{}", name_index)),
|
|
||||||
// BlueprintName("Health_Pickup".to_string()),
|
|
||||||
// SpawnHere,
|
|
||||||
TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)),
|
|
||||||
Velocity {
|
|
||||||
linvel: Vec3::new(vel_x, vel_y, vel_z),
|
|
||||||
angvel: Vec3::new(0.0, 0.0, 0.0),
|
|
||||||
},
|
|
||||||
UnregisteredComponent,
|
|
||||||
))
|
|
||||||
.id();
|
|
||||||
commands.entity(world).add_child(new_entity);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -89,24 +89,10 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main_menu(
|
pub fn main_menu(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
|
|
||||||
mut next_app_state: ResMut<NextState<AppState>>,
|
mut next_app_state: ResMut<NextState<AppState>>,
|
||||||
// mut next_game_state: ResMut<NextState<GameState>>,
|
|
||||||
// mut save_requested_events: EventWriter<SaveRequest>,
|
|
||||||
// mut load_requested_events: EventWriter<LoadRequest>,
|
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::Return) {
|
if keycode.just_pressed(KeyCode::Enter) {
|
||||||
next_app_state.set(AppState::AppLoading);
|
next_app_state.set(AppState::AppLoading);
|
||||||
// next_game_state.set(GameState::None);
|
|
||||||
}
|
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::L) {
|
|
||||||
next_app_state.set(AppState::AppLoading);
|
|
||||||
// load_requested_events.send(LoadRequest { path: "toto".into() })
|
|
||||||
}
|
|
||||||
|
|
||||||
if keycode.just_pressed(KeyCode::S) {
|
|
||||||
// save_requested_events.send(SaveRequest { path: "toto".into() })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ impl Plugin for GamePlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
Update,
|
Update,
|
||||||
(spawn_test, spawn_test_unregisted_components).run_if(in_state(GameState::InGame)),
|
(spawn_test).run_if(in_state(GameState::InGame)),
|
||||||
)
|
)
|
||||||
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
|
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
|
||||||
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
|
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_editor_pls::prelude::*;
|
|
||||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||||
|
|
||||||
mod core;
|
mod core;
|
||||||
|
@ -15,8 +14,6 @@ fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins((
|
.add_plugins((
|
||||||
DefaultPlugins.set(AssetPlugin::default()),
|
DefaultPlugins.set(AssetPlugin::default()),
|
||||||
// editor
|
|
||||||
EditorPlugin::default(),
|
|
||||||
// our custom plugins
|
// our custom plugins
|
||||||
CommonPlugin,
|
CommonPlugin,
|
||||||
CorePlugin, // reusable plugins
|
CorePlugin, // reusable plugins
|
||||||
|
|
|
@ -5,9 +5,9 @@ edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.12"
|
bevy="0.13"
|
||||||
bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
|
bevy_asset_loader = { version = "0.20", features = ["standard_dynamic_assets" ]}
|
||||||
bevy_editor_pls = { version = "0.6" }
|
#bevy_editor_pls = { version = "0.6" }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
|
|
@ -2,6 +2,7 @@ use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings};
|
||||||
use bevy::core_pipeline::experimental::taa::TemporalAntiAliasBundle;
|
use bevy::core_pipeline::experimental::taa::TemporalAntiAliasBundle;
|
||||||
use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping};
|
use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping};
|
||||||
use bevy::pbr::ScreenSpaceAmbientOcclusionBundle;
|
use bevy::pbr::ScreenSpaceAmbientOcclusionBundle;
|
||||||
|
use bevy::render::camera::Exposure;
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
|
||||||
use super::CameraTrackingOffset;
|
use super::CameraTrackingOffset;
|
||||||
|
@ -17,6 +18,7 @@ pub fn camera_replace_proxies(
|
||||||
(
|
(
|
||||||
Entity,
|
Entity,
|
||||||
&mut Camera,
|
&mut Camera,
|
||||||
|
&mut Exposure,
|
||||||
Option<&BloomSettings>,
|
Option<&BloomSettings>,
|
||||||
Option<&SSAOSettings>,
|
Option<&SSAOSettings>,
|
||||||
),
|
),
|
||||||
|
@ -26,9 +28,10 @@ pub fn camera_replace_proxies(
|
||||||
added_bloom_settings: Query<&BloomSettings, Added<BloomSettings>>,
|
added_bloom_settings: Query<&BloomSettings, Added<BloomSettings>>,
|
||||||
added_ssao_settings: Query<&SSAOSettings, Added<SSAOSettings>>, // Move to camera
|
added_ssao_settings: Query<&SSAOSettings, Added<SSAOSettings>>, // Move to camera
|
||||||
) {
|
) {
|
||||||
for (entity, mut camera, bloom_settings, ssao_setting) in added_cameras.iter_mut() {
|
for (entity, mut camera, mut exposure, bloom_settings, ssao_setting) in added_cameras.iter_mut() {
|
||||||
info!("detected added camera, updating proxy");
|
info!("detected added camera, updating proxy");
|
||||||
camera.hdr = true;
|
camera.hdr = true;
|
||||||
|
// exposure.ev100 *= 0.8;
|
||||||
commands
|
commands
|
||||||
.entity(entity)
|
.entity(entity)
|
||||||
.insert(DebandDither::Enabled)
|
.insert(DebandDither::Enabled)
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub fn lighting_replace_proxies(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
) {
|
) {
|
||||||
for (entity, mut light) in added_dirights.iter_mut() {
|
for (entity, mut light) in added_dirights.iter_mut() {
|
||||||
light.illuminance *= 5.0;
|
// light.illuminance *= 5.0; // arbitrary/ eyeballed to match the levels of Blender
|
||||||
light.shadows_enabled = true;
|
light.shadows_enabled = true;
|
||||||
let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder {
|
let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder {
|
||||||
first_cascade_far_bound: 15.0,
|
first_cascade_far_bound: 15.0,
|
||||||
|
@ -41,7 +41,7 @@ pub fn lighting_replace_proxies(
|
||||||
}
|
}
|
||||||
|
|
||||||
for mut light in added_pointlights.iter_mut() {
|
for mut light in added_pointlights.iter_mut() {
|
||||||
light.intensity *= 0.001; // arbitrary/ eyeballed to match the levels of Blender
|
// light.intensity *= 0.001; // arbitrary/ eyeballed to match the levels of Blender
|
||||||
light.shadows_enabled = true;
|
light.shadows_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,9 +50,10 @@ pub fn lighting_replace_proxies(
|
||||||
}
|
}
|
||||||
|
|
||||||
for ambient in added_ambient_proxies.iter() {
|
for ambient in added_ambient_proxies.iter() {
|
||||||
|
println!("AMBIENT {:?} {}", ambient.color, ambient.brightness);
|
||||||
commands.insert_resource(AmbientLight {
|
commands.insert_resource(AmbientLight {
|
||||||
color: ambient.color,
|
color: ambient.color,
|
||||||
brightness: ambient.brightness,
|
brightness: ambient.brightness,// * 4000.,
|
||||||
});
|
});
|
||||||
// FIXME: does this belong here ?
|
// FIXME: does this belong here ?
|
||||||
commands.insert_resource(ClearColor(ambient.color * ambient.brightness));
|
commands.insert_resource(ClearColor(ambient.color * ambient.brightness));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use bevy::{
|
use bevy::{
|
||||||
ecs::system::Res,
|
ecs::system::Res,
|
||||||
input::{keyboard::KeyCode, Input},
|
input::{keyboard::KeyCode, ButtonInput},
|
||||||
log::info,
|
log::info,
|
||||||
prelude::ResMut,
|
prelude::ResMut,
|
||||||
};
|
};
|
||||||
|
@ -18,9 +18,9 @@ pub fn resume_physics(mut physics_config: ResMut<RapierConfiguration>) {
|
||||||
|
|
||||||
pub fn toggle_physics_debug(
|
pub fn toggle_physics_debug(
|
||||||
mut debug_config: ResMut<DebugRenderContext>,
|
mut debug_config: ResMut<DebugRenderContext>,
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
) {
|
) {
|
||||||
if keycode.just_pressed(KeyCode::D) {
|
if keycode.just_pressed(KeyCode::KeyD) {
|
||||||
debug_config.enabled = !debug_config.enabled;
|
debug_config.enabled = !debug_config.enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,22 +8,22 @@ use crate::GameState;
|
||||||
pub struct Player;
|
pub struct Player;
|
||||||
|
|
||||||
fn player_move_demo(
|
fn player_move_demo(
|
||||||
keycode: Res<Input<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
mut players: Query<&mut Transform, With<Player>>,
|
mut players: Query<&mut Transform, With<Player>>,
|
||||||
) {
|
) {
|
||||||
let speed = 0.2;
|
let speed = 0.2;
|
||||||
if let Ok(mut player) = players.get_single_mut() {
|
if let Ok(mut player) = players.get_single_mut() {
|
||||||
if keycode.pressed(KeyCode::Left) {
|
if keycode.pressed(KeyCode::ArrowLeft) {
|
||||||
player.translation.x += speed;
|
player.translation.x += speed;
|
||||||
}
|
}
|
||||||
if keycode.pressed(KeyCode::Right) {
|
if keycode.pressed(KeyCode::ArrowRight) {
|
||||||
player.translation.x -= speed;
|
player.translation.x -= speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if keycode.pressed(KeyCode::Up) {
|
if keycode.pressed(KeyCode::ArrowUp) {
|
||||||
player.translation.z += speed;
|
player.translation.z += speed;
|
||||||
}
|
}
|
||||||
if keycode.pressed(KeyCode::Down) {
|
if keycode.pressed(KeyCode::ArrowDown) {
|
||||||
player.translation.z -= speed;
|
player.translation.z -= speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ pub mod game;
|
||||||
pub use game::*;
|
pub use game::*;
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
// use bevy_editor_pls::prelude::*;
|
||||||
|
|
||||||
pub struct CommonPlugin;
|
pub struct CommonPlugin;
|
||||||
impl Plugin for CommonPlugin {
|
impl Plugin for CommonPlugin {
|
||||||
|
|
|
@ -52,6 +52,6 @@ pub struct InGameLoading;
|
||||||
pub struct StatePlugin;
|
pub struct StatePlugin;
|
||||||
impl Plugin for StatePlugin {
|
impl Plugin for StatePlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_state::<AppState>().add_state::<GameState>();
|
app.init_state::<AppState>().init_state::<GameState>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue