use bevy::prelude::*; use leafwing_input_manager::prelude::*; use serde::{ Serialize, Deserialize }; pub mod plugin; #[derive(Actionlike, PartialEq, Eq, Hash, Debug, Clone, Reflect, Serialize, Deserialize)] pub enum InputAction { #[actionlike(Axis)] Move, ToggleInventory, Interact, } impl InputAction { pub fn default_input_map() -> InputMap { InputMap::default() .with_axis(Self::Move, VirtualAxis::ad()) .with_axis(Self::Move, GamepadAxis::LeftStickX) .with(Self::ToggleInventory, KeyCode::KeyI) .with(Self::ToggleInventory, GamepadButton::Select) .with(Self::Interact, KeyCode::KeyE) .with(Self::Interact, GamepadButton::East) } } #[derive(Actionlike, PartialEq, Eq, Hash, Debug, Clone, Reflect, Serialize, Deserialize)] pub enum UiAction { Rotate, } impl UiAction { pub fn default_input_map() -> InputMap { InputMap::default() .with(Self::Rotate, KeyCode::KeyR) .with(Self::Rotate, GamepadButton::West) } }