generated from 2ndbeam/bevy-template
- Bump version to 0.2.0 - Split every module to systems, observers, plugins, etc - Renamed Crate to Container - Removed Wall component - Removed try_insert_item system - Removed inventory::ui module
41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
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<Self> {
|
|
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<Self> {
|
|
InputMap::default()
|
|
.with(Self::Rotate, KeyCode::KeyR)
|
|
.with(Self::Rotate, GamepadButton::West)
|
|
}
|
|
}
|