euv_engine/entity/enum.rs
1use crate::*;
2
3/// Events that can be emitted by entities for inter-entity communication.
4///
5/// The event system allows decoupled game logic by enabling entities to
6/// broadcast events that other entities or systems can subscribe to.
7#[derive(Clone, Debug)]
8pub enum EntityEvent {
9 /// Emitted when the entity collides with another entity.
10 Collision {
11 /// The ID of the other entity involved in the collision.
12 other_id: u64,
13 /// The collision normal pointing from this entity to the other.
14 normal: Vector2D,
15 /// The penetration depth of the collision.
16 depth: f64,
17 },
18 /// Emitted when the entity enters a trigger zone identified by a tag.
19 TriggerEnter {
20 /// The tag of the trigger zone that was entered.
21 tag: String,
22 },
23 /// Emitted when the entity exits a trigger zone identified by a tag.
24 TriggerExit {
25 /// The tag of the trigger zone that was exited.
26 tag: String,
27 },
28 /// Emitted when the entity is spawned into the scene.
29 Spawn,
30 /// Emitted when the entity is destroyed and removed from the scene.
31 Destroy,
32 /// A custom event with an arbitrary name and optional string data.
33 Custom {
34 /// The name identifying the custom event.
35 name: String,
36 /// Optional string payload carried by the event.
37 data: String,
38 },
39}