mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-26 21:37:01 +00:00
chore(testing): updated the testing bevy project
This commit is contained in:
parent
5192518b12
commit
f5b063cd34
@ -1,6 +1,6 @@
|
|||||||
({
|
({
|
||||||
"world":File (path: "models/World.glb"),
|
/*"world":File (path: "models/World.glb"),
|
||||||
"models": Folder (
|
"models": Folder (
|
||||||
path: "models/library",
|
path: "models/library",
|
||||||
),
|
),*/
|
||||||
})
|
})
|
@ -11,6 +11,7 @@ impl Plugin for CorePlugin {
|
|||||||
legacy_mode: false,
|
legacy_mode: false,
|
||||||
library_folder: "models/library".into(),
|
library_folder: "models/library".into(),
|
||||||
format: GltfFormat::GLB,
|
format: GltfFormat::GLB,
|
||||||
|
material_library:true,
|
||||||
aabbs: true,
|
aabbs: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use bevy::prelude::*;
|
use bevy::{prelude::*, utils::hashbrown::HashMap};
|
||||||
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
|
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, BlueprintsList, GameWorldTag, Library, SpawnHere};
|
||||||
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
|
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
|
||||||
|
|
||||||
use bevy_rapier3d::prelude::Velocity;
|
use bevy_rapier3d::prelude::Velocity;
|
||||||
@ -7,31 +7,19 @@ use rand::Rng;
|
|||||||
|
|
||||||
pub fn setup_game(
|
pub fn setup_game(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
game_assets: Res<GameAssets>,
|
asset_server: Res<AssetServer>,
|
||||||
models: Res<Assets<bevy::gltf::Gltf>>,
|
|
||||||
mut next_game_state: ResMut<NextState<GameState>>,
|
mut next_game_state: ResMut<NextState<GameState>>,
|
||||||
) {
|
) {
|
||||||
commands.insert_resource(AmbientLight {
|
|
||||||
color: Color::WHITE,
|
|
||||||
brightness: 0.2,
|
|
||||||
});
|
|
||||||
// here we actually spawn our game world/level
|
// here we actually spawn our game world/level
|
||||||
|
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
SceneBundle{
|
SceneBundle{
|
||||||
// note: because of this issue https://github.com/bevyengine/bevy/issues/10436, "world" is now a gltf file instead of a scene
|
scene: asset_server.load("models/World.glb#Scene0"),
|
||||||
scene: models
|
|
||||||
.get(game_assets.world.id())
|
|
||||||
.expect("main level should have been loaded")
|
|
||||||
.scenes[0]
|
|
||||||
.clone(),
|
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
bevy::prelude::Name::from("world"),
|
bevy::prelude::Name::from("world"),
|
||||||
GameWorldTag,
|
GameWorldTag,
|
||||||
InAppRunning,
|
InAppRunning,
|
||||||
));
|
));
|
||||||
|
|
||||||
next_game_state.set(GameState::InGame)
|
next_game_state.set(GameState::InGame)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,13 +97,15 @@ impl Plugin for GamePlugin {
|
|||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_systems(Update, (spawn_test).run_if(in_state(GameState::InGame)))
|
app.add_systems(Update, (spawn_test).run_if(in_state(GameState::InGame)))
|
||||||
.add_systems(Update, validate_export)
|
.add_systems(Update, validate_export)
|
||||||
.add_systems(Update, generate_screenshot.run_if(on_timer(Duration::from_secs_f32(0.2)))) // TODO: run once
|
|
||||||
.add_systems(OnEnter(AppState::MenuRunning), start_game)
|
.add_systems(OnEnter(AppState::MenuRunning), start_game)
|
||||||
.add_systems(OnEnter(AppState::AppRunning), setup_game)
|
.add_systems(OnEnter(AppState::AppRunning), setup_game)
|
||||||
|
/* .add_systems(Update, generate_screenshot.run_if(on_timer(Duration::from_secs_f32(0.2)))) // TODO: run once
|
||||||
|
|
||||||
|
|
||||||
.add_systems(
|
.add_systems(
|
||||||
Update,
|
Update,
|
||||||
exit_game.run_if(on_timer(Duration::from_secs_f32(0.5))),
|
exit_game.run_if(on_timer(Duration::from_secs_f32(0.5))),
|
||||||
) // shut down the app after this time
|
) // shut down the app after this time*/
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user