1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
use specs::{
WriteStorage,
ReadStorage,
Entities,
System,
Join
};
use crate::{
components::{
TriggerBox,
OnSpawn,
New
}
};
pub struct SpawnTrigger;
impl <'a> System<'a> for SpawnTrigger {
type SystemData = (
Entities<'a>,
WriteStorage<'a, TriggerBox>,
ReadStorage<'a, OnSpawn>,
ReadStorage<'a, New>
);
fn run(&mut self, (entities, mut triggerboxes, onspawns, news): Self::SystemData) {
for (entity, onspawn, _new) in (&entities, &onspawns, &news).join(){
TriggerBox::add_message(&mut triggerboxes, entity, onspawn.trigger);
}
}
}
|