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 (
|
||||
path: "models/library",
|
||||
),
|
||||
),*/
|
||||
})
|
@ -11,6 +11,7 @@ impl Plugin for CorePlugin {
|
||||
legacy_mode: false,
|
||||
library_folder: "models/library".into(),
|
||||
format: GltfFormat::GLB,
|
||||
material_library:true,
|
||||
aabbs: true,
|
||||
..Default::default()
|
||||
},
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
|
||||
use bevy::{prelude::*, utils::hashbrown::HashMap};
|
||||
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, BlueprintsList, GameWorldTag, Library, SpawnHere};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
|
||||
|
||||
use bevy_rapier3d::prelude::Velocity;
|
||||
@ -7,31 +7,19 @@ use rand::Rng;
|
||||
|
||||
pub fn setup_game(
|
||||
mut commands: Commands,
|
||||
game_assets: Res<GameAssets>,
|
||||
models: Res<Assets<bevy::gltf::Gltf>>,
|
||||
asset_server: Res<AssetServer>,
|
||||
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
|
||||
|
||||
commands.spawn((
|
||||
SceneBundle{
|
||||
// note: because of this issue https://github.com/bevyengine/bevy/issues/10436, "world" is now a gltf file instead of a scene
|
||||
scene: models
|
||||
.get(game_assets.world.id())
|
||||
.expect("main level should have been loaded")
|
||||
.scenes[0]
|
||||
.clone(),
|
||||
scene: asset_server.load("models/World.glb#Scene0"),
|
||||
..default()
|
||||
},
|
||||
bevy::prelude::Name::from("world"),
|
||||
GameWorldTag,
|
||||
InAppRunning,
|
||||
));
|
||||
|
||||
next_game_state.set(GameState::InGame)
|
||||
}
|
||||
|
||||
|
@ -97,13 +97,15 @@ impl Plugin for GamePlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(Update, (spawn_test).run_if(in_state(GameState::InGame)))
|
||||
.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::AppRunning), setup_game)
|
||||
/* .add_systems(Update, generate_screenshot.run_if(on_timer(Duration::from_secs_f32(0.2)))) // TODO: run once
|
||||
|
||||
|
||||
.add_systems(
|
||||
Update,
|
||||
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