From 029a53c11504a53c61709229ca0b0680ce6675bd Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 19 Mar 2024 06:01:17 +0100 Subject: [PATCH] implement delays between messages --- assets/scenes/conversations.scn.ron | 19 ++++++++++++++++--- src/actor.rs | 18 ++++++++++++------ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/assets/scenes/conversations.scn.ron b/assets/scenes/conversations.scn.ron index 5a61e8a..8f91596 100644 --- a/assets/scenes/conversations.scn.ron +++ b/assets/scenes/conversations.scn.ron @@ -7,7 +7,7 @@ id: "hialien", name: "Icarus", label: "INIT", - delay: 0.0, + delay: 3.0, sound: "ping", reply: "Requesting permission to communicate...", goto: "requested", @@ -20,7 +20,7 @@ id: "hialien", name: "Icarus", label: "requested", - delay: 1.0, + delay: 5.0, sound: "chat", reply: "Oh hey there, didn't even notice you! Was playing some VR game! What's up?", goto: "reply1", @@ -33,9 +33,22 @@ id: "hialien", name: "Icarus", label: "reply1", - delay: 3.0, + delay: 1.0, sound: "chat", reply: "Not so chatty, huh? That's ok. See you around.", + goto: "disco", + ), + }, + ), + 4294967299: ( + components: { + "outfly::actor::ChatBranch": ( + id: "hialien", + name: "Icarus", + label: "disco", + delay: 0.0, + sound: "ping", + reply: "Disconnected.", goto: "EXIT", ), }, diff --git a/src/actor.rs b/src/actor.rs index c26444f..3c80279 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -53,7 +53,7 @@ pub struct ChatBranch { pub id: String, pub name: String, pub label: String, - pub delay: f32, + pub delay: f64, pub sound: String, pub reply: String, pub goto: String, @@ -72,7 +72,7 @@ pub struct ChatChoice { pub struct Chat { pub id: String, pub label: String, - pub timer: f32, + pub timer: f64, } #[derive(Component)] @@ -182,16 +182,14 @@ pub fn handle_input( pub fn handle_new_conversations( mut commands: Commands, mut er_conv: EventReader, - mut log: ResMut, + time: Res