Trait big_brain::scorers::ScorerBuilder [−][src]
Trait that must be defined by types in order to be ScorerBuilder
s. ScorerBuilder
s’ job is to spawn new Scorer
entities. In general, most of this is already done for you, and the only method you really have to implement is .build()
.
The build()
method MUST be implemented for any ScorerBuilder
s you want to define.
Required methods
fn build(&self, cmd: &mut Commands<'_>, scorer: Entity, actor: Entity)
[src]
MUST insert your concrete Scorer component into the Scorer [Entity
], using cmd
. You may use actor
, but it’s perfectly normal to just ignore it.
Example
struct MyBuilder; struct MyScorer; impl ScorerBuilder for MyBuilder { fn build(&self, cmd: &mut Commands, action: Entity, actor: Entity) { cmd.entity(action).insert(MyScorer); } }
Provided methods
fn attach(&self, cmd: &mut Commands<'_>, actor: Entity) -> Entity
[src]
Don’t implement this yourself unless you know what you’re doing.