This seems like a fairly complicated way to try to answer what seems like a fairly simple question: Is the player currently using Keyboard & Mouse, or are they using a Controller? I'm trying to find a reliable way to determine that. Just trying to answer the question of whether, at any given moment, the player is using the Mouse & Keyboard, or the Controller. And very often there are no player actions associated with mouse movement on Pause/Menu screens.Īnyway, I'm hoping I'm just missing something simple here. The LastInputType only works if the player happens to press one of the buttons associated with a PlayerAction. But then, ideally, if they move the mouse or press any key on the keyboard, that controller-ui content will be hidden. Is there any lower-level information I can access to learn that the last device that generated some input (even unused input) was keyboard, mouse, or controller? I'm trying to set up some common behavior where if the player does something on a controller, the screen changes to show some controller-specific content. I've tried to use the approach mentioned here, to look at the LastInputType on various PlayerActionSets, but there's a downside to that: it only fires when one of the specific PlayerActions in the PlayerActionSet is used. I didn't handle every possible case, because I didn't need everything, but here's the code I wrote:Ĭlick to expand. Is there a general approach to making one binding take on the characteristics of another? Or do I need to test what concrete BindingSource type the object is, instantiate a new one, a manually assign all of the public properties?Įdit: I did end up just creating a utility method to return a "copy" of a binding, by newing up a binding and setting its values. It doesn't seem possible to clear the BoundTo field on the copy to avoid this. Unfortunately, that results in "Binding source is already bound to action" warnings. Instead, I'm instantiating a copy of my PlayerActionSet, and using ReplaceBinding to replace the binding with the copy. Because I don't want to reset every binding (only the keyboard bindings, or only the controller bindings) I can't use 'ResetBindings', since that would reset everything. On my input screen, I let the player reset the Keyboard inputs, or reset the Controller inputs, with two distinct buttons. I was wondering what the correct approach was for resetting some, but not all, bindings in a PlayerAction to a default state? For example, I have PlayerActions that have a mix of Keyboard bindings and Controller bindings.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |