use aery::prelude::*;
use bevy::prelude::*;
use crate::builder::TalkBuilder;
#[derive(Relation)]
#[aery(Recursive, Poly)]
pub struct FollowedBy;
#[derive(Relation)]
#[aery(Recursive, Poly)]
pub struct PerformedBy;
#[derive(Component, Default, Debug)]
pub struct Talk {
pub has_started: bool,
}
impl Talk {
pub fn builder() -> TalkBuilder {
TalkBuilder::default()
}
}
#[derive(Component)]
#[component(storage = "SparseSet")]
pub struct CurrentNode;
#[derive(Component, Default, Debug)]
pub struct StartNode;
#[derive(Component, Default, Debug)]
pub struct EndNode;
#[derive(Component, Reflect, Default, Debug)]
#[reflect(Component)]
pub struct TextNode(pub String);
#[derive(Component, Reflect, Default, Debug)]
#[reflect(Component)]
pub struct ChoiceNode(pub Vec<Choice>);
#[derive(Component, Reflect, Default, Debug)]
#[reflect(Component)]
pub struct JoinNode;
#[derive(Component, Reflect, Default, Debug)]
#[reflect(Component)]
pub struct LeaveNode;
#[derive(Debug, Reflect, Clone)]
pub struct Choice {
pub text: String,
pub next: Entity,
}
impl Choice {
pub fn new(text: impl Into<String>, next: Entity) -> Self {
Self {
text: text.into(),
next,
}
}
}