paiagram_core/
interval.rs1use bevy::ecs::query::QueryData;
2use bevy::prelude::*;
3
4use crate::units::distance::Distance;
5
6#[derive(Reflect, Component)]
8#[reflect(Component)]
9pub struct Interval {
10 pub length: Distance,
11}
12
13#[derive(QueryData)]
14pub struct IntervalQuery {
15 distance: &'static Interval,
16}
17
18impl<'w, 's> IntervalQueryItem<'w, 's> {
19 pub fn distance(&self) -> Distance {
20 self.distance.length
21 }
22}
23
24#[derive(EntityEvent)]
25pub struct UpdateInterval {
26 pub entity: Entity,
27 pub source: Entity,
28 pub target: Entity,
29}