bevy_input_bindings 0.0.2

High level, flexible and shareable input binding library for the Bevy game engine
Documentation
use bevy::ecs::entity::Entity;
use bevy::ecs::event::EntityEvent;

/// An `ActionEvent` is a Bevy event that was triggered by a controller and is attached to a custom
/// action.
#[derive(EntityEvent)]
pub struct ActionEvent<ActionKey> {
    #[event_target]
    pub(crate) controller: Entity,
    pub(crate) controlling: Vec<Entity>,
    pub(crate) action_key: ActionKey,
}

impl<ActionKey> ActionEvent<ActionKey> {
    /// Access to the controller entity that triggered this event.
    pub fn controller(&self) -> Entity {
        self.controller
    }

    /// Get the key of the action. This allows to identify what action has been triggered.
    pub fn key<'a>(&'a self) -> &'a ActionKey {
        &self.action_key
    }

    /// Access to all the entity that this action event should update. This is automatically defined
    /// by the relationships components `ControlledBy` and `Controlling`.
    pub fn controlling<'a>(&'a self) -> &'a Vec<Entity> {
        &self.controlling
    }
}