Skip to content

Commit

Permalink
feat: update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchantey committed Jul 28, 2024
1 parent 9341c5a commit 686e899
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 73 deletions.
2 changes: 2 additions & 0 deletions crates/beet_examples/src/plugins/beet_example_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use beet_spatial::prelude::*;
use beetmash::prelude::*;
use bevy::prelude::*;


/// A running app with flow and spatial
pub fn running_beet_example_plugin(app: &mut App) {
app.add_plugins((
BeetmashDefaultPlugins::with_beetmash_assets(),
Expand Down
12 changes: 6 additions & 6 deletions crates/beet_examples/src/scenes/ml/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ pub fn fetch_npc(mut commands: Commands) {
Name::new("Fetch Behavior"),
TargetAgent(agent),
AssetRunOnReady::<Bert>::new("default-bert.ron"),
// InsertSentenceOnUserInput::default(),
// InsertSentenceSteerTarget::<Collectable>::default(),
// RunOnSteerTargetInsert::default().with_source(agent),
// RunOnSteerTargetRemove::default().with_source(agent),
// ScoreFlow::default(),
// RemoveOnTrigger::<OnRunResult, Sentence>::default(),
InsertSentenceOnUserInput::default(),
InsertSentenceSteerTarget::<Collectable>::default(),
RunOnSteerTargetInsert::default().with_source(agent),
RunOnSteerTargetRemove::default().with_source(agent),
ScoreFlow::default(),
RemoveOnTrigger::<OnRunResult, Sentence>::default(),
))
.with_children(|parent| {
parent.spawn((
Expand Down
6 changes: 2 additions & 4 deletions crates/beet_examples/src/scenes/spatial/seek.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,26 @@ use bevy::prelude::*;


pub fn seek(mut commands: Commands) {
// target
let target = commands
.spawn((
Name::new("Target"),
FollowCursor2d,
AssetLoadBlockAppReady,
BundlePlaceholder::Sprite("spaceship_pack/planet_6.png".into()),
Transform::from_translation(Vec3::new(200., 0., 0.)),
))
.id();

// agent
commands
.spawn((
// Transform::default(),
Name::new("Agent"),
BundlePlaceholder::Sprite("spaceship_pack/ship_2.png".into()),
AssetLoadBlockAppReady,
RotateToVelocity2d,
ForceBundle::default(),
SteerBundle::default().scaled_to(500.).with_target(target),
))
.with_children(|parent| {
// behavior
parent.spawn((
Name::new("Seek"),
RunOnAppReady::default(),
Expand Down
1 change: 0 additions & 1 deletion crates/beet_flow/src/actions/misc/trigger_in_duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ pub fn trigger_in_duration<T: GenericActionEvent>(
mut query: Query<(Entity, &RunTimer, &TriggerInDuration<T>), With<Running>>,
) {
for (entity, timer, insert_in_duration) in query.iter_mut() {
println!("here!{:?}", timer.last_started.elapsed());
if timer.last_started.elapsed() >= insert_in_duration.duration {
commands
.entity(entity)
Expand Down
9 changes: 2 additions & 7 deletions examples/app_ml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@
//! - frozen lake - train: `beet-debug ui-terminal lighting-3d frozen-lake-scene frozen-lake-train`
//! - frozen lake - run: `beet-debug ui-terminal lighting-3d frozen-lake-scene frozen-lake-run`
//!
use beet::prelude::FrozenLakePlugin;
use beet_examples::prelude::*;
use bevy::prelude::*;


fn main() {
App::new()
.add_plugins((
BeetmashDefaultPlugins::with_beetmash_assets(),
ExamplePluginTypesFull,
MlPlugin,
FrozenLakePlugin
))
.add_plugins((running_beet_example_plugin, plugin_ml))
.run();
}
16 changes: 8 additions & 8 deletions examples/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ use bevy::prelude::*;

pub fn main() {
App::new()
.add_plugins(ExamplePluginFull)
.add_plugins((running_beet_example_plugin, plugin_ml))
.add_systems(
Startup,
(
scenes::beet_debug,
scenes::ui_terminal_input,
scenes::lighting_3d,
scenes::ground_3d,
scenes::fetch_scene,
scenes::fetch_npc,
beetmash::core::scenes::ui_terminal_input,
beetmash::core::scenes::lighting_3d,
beetmash::core::scenes::ground_3d,
beet_examples::scenes::flow::beet_debug,
beet_examples::scenes::ml::fetch_scene,
beet_examples::scenes::ml::fetch_npc,
),
)
.run();
}
}
10 changes: 5 additions & 5 deletions examples/flock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ use bevy::prelude::*;

pub fn main() {
App::new()
.add_plugins(ExamplePluginBasics)
.add_plugins(running_beet_example_plugin)
.add_systems(
Startup,
(
scenes::beet_debug,
scenes::camera_2d,
scenes::space_scene,
scenes::flock,
beetmash::core::scenes::camera_2d,
beetmash::core::scenes::space_scene,
beet_examples::scenes::flow::beet_debug,
beet_examples::scenes::spatial::flock,
),
)
.run();
Expand Down
12 changes: 6 additions & 6 deletions examples/frozen_lake_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use bevy::prelude::*;

pub fn main() {
App::new()
.add_plugins(ExamplePluginFull)
.add_plugins((running_beet_example_plugin, plugin_ml))
.add_systems(
Startup,
(
scenes::beet_debug,
scenes::ui_terminal,
scenes::lighting_3d,
scenes::frozen_lake::frozen_lake_scene,
scenes::frozen_lake::frozen_lake_run,
// beetmash::core::scenes::ui_terminal,
beetmash::core::scenes::lighting_3d,
// beet_examples::scenes::flow::beet_debug,
beet_examples::scenes::ml::frozen_lake_scene,
beet_examples::scenes::ml::frozen_lake_run,
),
)
.run();
Expand Down
12 changes: 6 additions & 6 deletions examples/frozen_lake_train.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use bevy::prelude::*;

pub fn main() {
App::new()
.add_plugins(ExamplePluginFull)
.add_plugins((running_beet_example_plugin, plugin_ml))
.add_systems(
Startup,
(
scenes::beet_debug,
scenes::ui_terminal,
scenes::lighting_3d,
scenes::frozen_lake::frozen_lake_scene,
scenes::frozen_lake::frozen_lake_train,
// beetmash::core::scenes::ui_terminal,
beetmash::core::scenes::lighting_3d,
// beet_examples::scenes::flow::beet_debug,
beet_examples::scenes::ml::frozen_lake_scene,
beet_examples::scenes::ml::frozen_lake_train,
),
)
.run();
Expand Down
12 changes: 6 additions & 6 deletions examples/hello_animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use bevy::prelude::*;

pub fn main() {
App::new()
.add_plugins(ExamplePluginBasics)
.add_plugins(running_beet_example_plugin)
.add_systems(
Startup,
(
scenes::beet_debug,
scenes::ui_terminal,
scenes::lighting_3d,
scenes::ground_3d,
scenes::hello_animation,
beetmash::core::scenes::ui_terminal,
beetmash::core::scenes::lighting_3d,
beetmash::core::scenes::ground_3d,
beet_examples::scenes::flow::beet_debug,
beet_examples::scenes::spatial::hello_animation,
),
)
.run();
Expand Down
12 changes: 6 additions & 6 deletions examples/hello_ml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ use bevy::prelude::*;

pub fn main() {
App::new()
.add_plugins(ExamplePluginFull)
.add_plugins((running_beet_example_plugin, plugin_ml))
.add_systems(
Startup,
(
scenes::beet_debug,
scenes::camera_2d,
scenes::ui_terminal_input,
scenes::hello_ml,
beetmash::core::scenes::camera_2d,
beetmash::core::scenes::ui_terminal_input,
beet_examples::scenes::flow::beet_debug,
beet_examples::scenes::ml::hello_ml,
),
)
.run();
}
}
9 changes: 2 additions & 7 deletions examples/hello_utility_ai.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
use beet::prelude::*;
use bevy::log::LogPlugin;
use beet_examples::prelude::*;
use bevy::prelude::*;

#[rustfmt::skip]
fn main() {
App::new()
.insert_resource(BeetDebugConfig::default())
.add_plugins((
LogPlugin::default(),
BeetDebugPluginBase,
BeetDebugPluginStdout,
LifecyclePlugin,
))
.add_plugins(running_beet_example_plugin)
.world_mut()
.spawn((
Name::new("ScoreFlow will select the highest score"),
Expand Down
10 changes: 5 additions & 5 deletions examples/seek.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ use bevy::prelude::*;

pub fn main() {
App::new()
.add_plugins(ExamplePluginBasics)
.add_plugins(running_beet_example_plugin)
.add_systems(
Startup,
(
scenes::beet_debug,
scenes::camera_2d,
scenes::space_scene,
scenes::seek,
beetmash::core::scenes::camera_2d,
beetmash::core::scenes::space_scene,
beet_examples::scenes::flow::beet_debug,
beet_examples::scenes::spatial::seek,
),
)
.run();
Expand Down
12 changes: 6 additions & 6 deletions examples/seek_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use bevy::prelude::*;

pub fn main() {
App::new()
.add_plugins(ExamplePluginBasics)
.add_plugins(running_beet_example_plugin)
.add_systems(
Startup,
(
scenes::beet_debug,
scenes::lighting_3d,
scenes::ground_3d,
scenes::seek_3d,
scenes::ui_terminal,
beetmash::core::scenes::ui_terminal,
beetmash::core::scenes::lighting_3d,
beetmash::core::scenes::ground_3d,
beet_examples::scenes::flow::beet_debug,
beet_examples::scenes::spatial::seek_3d,
),
)
.run();
Expand Down

0 comments on commit 686e899

Please sign in to comment.