use bevy::prelude::{Component, Event};
use crate::act::ActPattern;
use crate::time_limit::TimeLimit;
#[derive(Component, Debug, Clone)]
pub struct InputSequence<E> {
pub event: E,
pub acts: Vec<ActPattern>,
pub time_limit: Option<TimeLimit>,
}
impl<E> InputSequence<E>
where
E: Event + Clone,
{
#[inline(always)]
pub fn new<T>(event: E, acts: impl IntoIterator<Item = T>) -> InputSequence<E>
where
ActPattern: From<T>,
{
Self {
event,
time_limit: None,
acts: Vec::from_iter(acts.into_iter().map(ActPattern::from)),
}
}
pub fn time_limit(mut self, time_limit: impl Into<TimeLimit>) -> Self {
self.time_limit = Some(time_limit.into());
self
}
}