feat: InputValue::to_float()
This commit is contained in:
+4
-23
@@ -268,8 +268,8 @@ dependencies = [
|
||||
"bevy",
|
||||
"bevy_controls",
|
||||
"bevy_controls_derive",
|
||||
"strum 0.26.2",
|
||||
"strum_macros 0.26.2",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -365,8 +365,8 @@ dependencies = [
|
||||
"bevy_input",
|
||||
"bevy_utils 0.12.1",
|
||||
"log",
|
||||
"strum 0.25.0",
|
||||
"strum_macros 0.25.3",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2614,31 +2614,12 @@ version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.26.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29"
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.25.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn 2.0.48",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.26.2"
|
||||
|
||||
@@ -424,6 +424,14 @@ impl InputValue {
|
||||
InputValue::Empty => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_float(&self) -> f32 {
|
||||
match self {
|
||||
InputValue::Boolean(value) => if *value { 1. } else { 0. },
|
||||
InputValue::Float(value) => *value,
|
||||
InputValue::Empty => 0.,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
common_traits_conditions! {
|
||||
|
||||
Reference in New Issue
Block a user