aboutsummaryrefslogtreecommitdiff
path: root/src/events.rs
diff options
context:
space:
mode:
authorLibravatar Silas Bartha <silas@exvacuum.dev>2024-08-23 09:30:30 -0400
committerLibravatar Silas Bartha <silas@exvacuum.dev>2024-08-23 09:30:30 -0400
commit85c80561669bdf7b0f491ee4d7e49f2cc8f7b81c (patch)
tree91fd51487ed4c855ed33cc2d7a2ec325aeb377d4 /src/events.rs
Initial Commit
Diffstat (limited to 'src/events.rs')
-rw-r--r--src/events.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/events.rs b/src/events.rs
new file mode 100644
index 0000000..43ca1ba
--- /dev/null
+++ b/src/events.rs
@@ -0,0 +1,19 @@
+//! Events which enable interactions between `Interactor` and `Interactable` entities.
+
+use bevy::prelude::*;
+
+/// Event sent by user to request an interaction from the given `Interactor` entity.
+#[derive(Event)]
+pub struct InteractorFiredEvent(pub Entity);
+
+/// Event sent by the plugin once an `InteractorFiredEvent` has been processed. It should be caught
+/// by the user to perform some action on the affected interactable entity.
+///
+/// It is not intended to be invoked directly.
+#[derive(Event)]
+pub struct InteractionEvent {
+ /// `Interactor` entity which triggered this interaction.
+ pub interactor: Entity,
+ /// `Interactable` entity whicg is receiving this interaction.
+ pub interactable: Entity,
+}