From 6871f4cb964853239f1fa0dab52d830978d1da04 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Wed, 26 May 2021 16:46:20 -0500 Subject: [PATCH] Make action type configurable. --- src/navigation.rs | 128 ++++++++++++++++++++++++++++++---------------- 1 file changed, 83 insertions(+), 45 deletions(-) diff --git a/src/navigation.rs b/src/navigation.rs index 74bfab9..a015578 100644 --- a/src/navigation.rs +++ b/src/navigation.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, error::Error, fmt::Debug, hash::Hash}; +use std::{collections::HashMap, error::Error, fmt::Debug, hash::Hash, marker::PhantomData}; use bevy::prelude::*; use bevy_input_actionmap::InputMap; @@ -68,17 +68,10 @@ pub struct Collision { pub index: usize, } -pub const ACTION_FORWARD: &str = "forward"; -pub const ACTION_BACKWARD: &str = "backward"; -pub const ACTION_LEFT: &str = "left"; -pub const ACTION_RIGHT: &str = "right"; -pub const ACTION_ROTATE_LEFT: &str = "ROTATE_LEFT"; -pub const ACTION_ROTATE_RIGHT: &str = "ROTATE_RIGHT"; -pub const ACTION_SPRINT: &str = "SPRINT"; - -fn movement_controls( +fn movement_controls( mut commands: Commands, - input: Res>, + config: Res>, + input: Res>, time: Res