浏览代码

Fix: Tidied ActionMap API

/V2
andytouch 4 年前
当前提交
60afd80a
共有 4 个文件被更改,包括 78 次插入77 次删除
  1. 110
      InputSystem_Warriors_Project/Assets/Input/InputActions_Player.inputactions
  2. 19
      InputSystem_Warriors_Project/Assets/Scenes/Scene_Example_Warriors.unity
  3. 15
      InputSystem_Warriors_Project/Assets/Scripts/Behaviours/Player/PlayerController.cs
  4. 11
      InputSystem_Warriors_Project/Assets/Scripts/Behaviours/Player/PlayerData.cs.meta

110
InputSystem_Warriors_Project/Assets/Input/InputActions_Player.inputactions


"id": "0914fb5b-51f6-4b26-9ed7-a3e72d065118",
"actions": [
{
"name": "TogglePause",
"type": "Button",
"id": "e773b1f9-ce5b-4fa2-9c1f-d194202c43b7",
"expectedControlType": "",
"processors": "",
"interactions": "Press"
},
{
"name": "Navigate",
"type": "PassThrough",
"id": "538ffe95-ba92-4acb-84f7-314f6ac8e0a5",

},
{
"name": "Submit",
"name": "Left Click",
"id": "5f571f6a-e9e7-4120-ae3c-79f846bdd202",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Cancel",
"type": "PassThrough",
"id": "146e681c-77dd-4ff0-9ad5-f4351fea14cc",
"id": "96c8be88-a7bb-4861-b5e9-956b4208d043",
"expectedControlType": "Button",
"processors": "",
"interactions": ""

"interactions": ""
},
{
"name": "Left Click",
"name": "Submit",
"id": "96c8be88-a7bb-4861-b5e9-956b4208d043",
"id": "5f571f6a-e9e7-4120-ae3c-79f846bdd202",
}
],
"bindings": [
},
"name": "",
"id": "dfac3b8e-d348-4a7a-b60b-14745c641340",
"path": "<Keyboard>/p",
"interactions": "",
"name": "Cancel",
"type": "PassThrough",
"id": "146e681c-77dd-4ff0-9ad5-f4351fea14cc",
"expectedControlType": "Button",
"groups": "Keyboard And Mouse",
"action": "TogglePause",
"isComposite": false,
"isPartOfComposite": false
"interactions": ""
"name": "",
"id": "f509a7b5-e79a-485e-ba2f-da5431d6fe4c",
"path": "<Gamepad>/start",
"interactions": "",
"name": "TogglePause",
"type": "Button",
"id": "e773b1f9-ce5b-4fa2-9c1f-d194202c43b7",
"expectedControlType": "",
"groups": "Gamepad",
"action": "TogglePause",
"isComposite": false,
"isPartOfComposite": false
},
"interactions": "Press"
}
],
"bindings": [
{
"name": "Gamepad Right Stick",
"id": "c1491510-9d0f-47b0-868e-99575e46d097",

},
{
"name": "",
"id": "cd72445d-e16d-49c4-8e4a-cd427d0d5fe9",
"path": "*/{Submit}",
"id": "b5076a57-fe62-4632-8d6c-da0844960a14",
"path": "<Mouse>/position",
"groups": "",
"action": "Submit",
"groups": "Keyboard And Mouse",
"action": "Point",
"id": "6fee8919-99e7-4770-abd4-da1b7d4e4cc4",
"path": "*/{Cancel}",
"id": "e7658a78-a141-4f0c-beb5-0a6a3e393c7b",
"path": "<Touchscreen>/touch*/position",
"groups": "",
"action": "Cancel",
"groups": "Touchscreen",
"action": "Point",
"id": "b5076a57-fe62-4632-8d6c-da0844960a14",
"path": "<Mouse>/position",
"id": "dfac3b8e-d348-4a7a-b60b-14745c641340",
"path": "<Keyboard>/p",
"action": "Point",
"action": "TogglePause",
"id": "e7658a78-a141-4f0c-beb5-0a6a3e393c7b",
"path": "<Touchscreen>/touch*/position",
"id": "f509a7b5-e79a-485e-ba2f-da5431d6fe4c",
"path": "<Gamepad>/start",
"groups": "Touchscreen",
"action": "Point",
"groups": "Gamepad",
"action": "TogglePause",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "6fee8919-99e7-4770-abd4-da1b7d4e4cc4",
"path": "*/{Cancel}",
"interactions": "",
"processors": "",
"groups": "",
"action": "Cancel",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "cd72445d-e16d-49c4-8e4a-cd427d0d5fe9",
"path": "*/{Submit}",
"interactions": "",
"processors": "",
"groups": "",
"action": "Submit",
"isComposite": false,
"isPartOfComposite": false
},

19
InputSystem_Warriors_Project/Assets/Scenes/Scene_Example_Warriors.unity


FieldOfView: 40
OrthographicSize: 10
NearClipPlane: 0.1
FarClipPlane: 1000
FarClipPlane: 100
Dutch: 0
LensShift: {x: 0, y: 0}
m_Transitions:

FieldOfView: 40
OrthographicSize: 10
NearClipPlane: 0.1
FarClipPlane: 1000
FarClipPlane: 100
Dutch: 0
LensShift: {x: 0, y: 0}
m_Transitions:

m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &246201655
MonoBehaviour:
m_ObjectHideFlags: 0

FieldOfView: 40
OrthographicSize: 10
NearClipPlane: 0.1
FarClipPlane: 1000
FarClipPlane: 100
Dutch: 0
LensShift: {x: 0, y: 0}
m_Transitions:

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1833978498}
m_LocalRotation: {x: 0.14559379, y: -0.0021589955, z: 0.00031772253, w: 0.98934203}
m_LocalPosition: {x: 0.015907818, y: -5.066736, z: -3.6449027}
m_LocalRotation: {x: 0.18110336, y: -0.002146068, z: 0.00039519602, w: 0.9834617}
m_LocalPosition: {x: 0.016107878, y: -4.5914693, z: -3.690742}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 193751149}

FieldOfView: 40
OrthographicSize: 10
NearClipPlane: 0.1
FarClipPlane: 1000
FarClipPlane: 100
Dutch: 0
LensShift: {x: 0, y: 0}
m_Transitions:

type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1743518200311987064, guid: ca9ee4e0ea2b85646be0b08bab27e559,
type: 3}
propertyPath: m_DefaultControlScheme
value:
objectReference: {fileID: 0}
- target: {fileID: 1743518200311987069, guid: ca9ee4e0ea2b85646be0b08bab27e559,
type: 3}

15
InputSystem_Warriors_Project/Assets/Scripts/Behaviours/Player/PlayerController.cs


private Vector3 smoothInputMovement;
//Action Maps
private string actionMapGameplay = "Player Controls";
private string actionMapMenu = "Menu Controls";
private string actionMapPlayerControls = "Player Controls";
private string actionMapMenuControls = "Menu Controls";
//Current Control Scheme
private string currentControlScheme;

//This is called from PlayerInput; when a joystick or arrow keys has been pushed.
//It stores the input Vector as a Vector3 to then be used by the smoothing function.
private void OnMovement(InputValue value)
{
Vector2 inputMovement = value.Get<Vector2>();

}
//Input's Axes values are raw
void CalculateMovementInputSmoothing()
{

//Switching Action Maps ----
playerInput.SwitchCurrentActionMap(actionMapGameplay);
playerInput.SwitchCurrentActionMap(actionMapPlayerControls);
playerInput.SwitchCurrentActionMap(actionMapMenu);
playerInput.SwitchCurrentActionMap(actionMapMenuControls);
}

11
InputSystem_Warriors_Project/Assets/Scripts/Behaviours/Player/PlayerData.cs.meta


fileFormatVersion: 2
guid: 7d57ccfec09c09443ab163d6a3096a57
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存