Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
big-brain
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Louis
big-brain
Commits
843e9eef
Unverified
Commit
843e9eef
authored
4 years ago
by
Kat Marchán
Browse files
Options
Downloads
Patches
Plain Diff
examples: remove confusing Idle action
parent
2b3b1255
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/thirst.rs
+1
-35
1 addition, 35 deletions
examples/thirst.rs
with
1 addition
and
35 deletions
examples/thirst.rs
+
1
−
35
View file @
843e9eef
...
...
@@ -99,38 +99,6 @@ fn drink_action_system(
}
}
#[derive(Debug,
Clone)]
struct
Idle
;
impl
Idle
{
fn
build
()
->
IdleBuilder
{
IdleBuilder
}
}
#[derive(Debug,
Clone)]
struct
IdleBuilder
;
impl
ActionBuilder
for
IdleBuilder
{
fn
build
(
&
self
,
cmd
:
&
mut
Commands
,
action
:
Entity
,
_actor
:
Entity
)
{
cmd
.entity
(
action
)
.insert
(
Idle
);
}
}
fn
idle_system
(
mut
query
:
Query
<&
mut
ActionState
,
With
<
Idle
>>
)
{
for
mut
state
in
query
.iter_mut
()
{
match
*
state
{
ActionState
::
Requested
=>
{
*
state
=
ActionState
::
Executing
;
}
ActionState
::
Cancelled
=>
{
*
state
=
ActionState
::
Success
;
}
ActionState
::
Executing
=>
{}
_
=>
{}
}
}
}
// Then, we have something called "Scorers". These are special components that
// run in the background, calculating a "Score" value, which is what Big Brain
// will use to pick which actions to execute.
...
...
@@ -188,8 +156,7 @@ pub fn init_entities(mut cmd: Commands) {
Thinker
::
build
()
.picker
(
FirstToScore
{
threshold
:
0.8
})
// Note that what we pass in are _builders_, not components!
.when
(
Thirsty
::
build
(),
Drink
::
build
())
.otherwise
(
Idle
::
build
()),
.when
(
Thirsty
::
build
(),
Drink
::
build
()),
);
}
...
...
@@ -202,6 +169,5 @@ fn main() {
.add_system
(
thirst_system
.system
())
.add_system
(
drink_action_system
.system
())
.add_system
(
thirsty_scorer_system
.system
())
.add_system
(
idle_system
.system
())
.run
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment