Skip to content
Snippets Groups Projects
Unverified Commit ab13f9a4 authored by Kat Marchán's avatar Kat Marchán
Browse files
parent e25dac5a
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@ First, you define actions and considerations, which are just plain old `Bevy`
```rust
use bevy::prelude::*;
use big_brain::*;
use big_brain::prelude::*;
#[derive(Debug, Clone)]
pub struct Thirsty;
......@@ -59,7 +59,7 @@ pub fn thirsty_scorer_system(
```rust
use bevy::prelude::*;
use big_brain::*;
use big_brain::prelude::*;
#[derive(Debug, Clone)]
pub struct Drink;
......
use bevy::prelude::*;
use big_brain::*;
use big_brain::prelude::*;
// First, we define a "Thirst" component and associated system. This is NOT
// THE AI. It's a plain old system that just makes an entity "thirstier" over
......@@ -156,7 +156,7 @@ pub fn init_entities(mut cmd: Commands) {
Thinker::build()
.picker(FirstToScore { threshold: 80.0 })
// Note that what we pass in are _builders_, not components!
.when(Thirsty::build(), Drink::build())
.when(Thirsty::build(), Drink::build()),
);
}
......
......@@ -2,7 +2,7 @@ use std::sync::Arc;
use bevy::prelude::*;
use crate::{ActionEnt, Actor};
use crate::thinker::{ActionEnt, Actor};
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum ActionState {
......
pub use bevy;
pub mod evaluators;
pub mod pickers;
pub use actions::*;
pub use choices::*;
pub use scorers::*;
pub use thinker::*;
pub use pickers::*;
pub mod actions;
pub mod choices;
pub mod scorers;
pub mod thinker;
pub mod evaluators;
mod pickers;
pub mod prelude {
use super::*;
mod actions;
mod choices;
mod scorers;
mod thinker;
pub use super::BigBrainPlugin;
pub use actions::{ActionBuilder, ActionState};
pub use pickers::{FirstToScore, Picker};
pub use scorers::{AllOrNothing, FixedScore, Score, ScorerBuilder, SumOfScorers};
pub use thinker::{Actor, Thinker};
}
use bevy::prelude::*;
......@@ -20,12 +22,12 @@ pub struct BigBrainPlugin;
impl Plugin for BigBrainPlugin {
fn build(&self, app: &mut AppBuilder) {
app.add_system(thinker_system.system());
app.add_system(thinker_component_attach_system.system());
app.add_system(thinker_component_detach_system.system());
app.add_system(steps_system.system());
app.add_system(fixed_score_system.system());
app.add_system(all_or_nothing_system.system());
app.add_system(sum_of_scorers_system.system());
app.add_system(thinker::thinker_system.system());
app.add_system(thinker::thinker_component_attach_system.system());
app.add_system(thinker::thinker_component_detach_system.system());
app.add_system(actions::steps_system.system());
app.add_system(scorers::fixed_score_system.system());
app.add_system(scorers::all_or_nothing_system.system());
app.add_system(scorers::sum_of_scorers_system.system());
}
}
......@@ -2,7 +2,7 @@ use std::sync::Arc;
use bevy::prelude::*;
use crate::{Actor, ScorerEnt};
use crate::thinker::{Actor, ScorerEnt};
#[derive(Debug, Clone, Default)]
pub struct Score(pub(crate) f32);
......@@ -116,7 +116,7 @@ impl ScorerBuilder for AllOrNothingBuilder {
cmd.entity(scorer)
.insert(Score::default())
.push_children(&scorers[..])
.insert(super::AllOrNothing {
.insert(AllOrNothing {
threshold: self.threshold,
scorers: scorers.into_iter().map(ScorerEnt).collect(),
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment