André McGrail
5 年前
当前提交
fde4e690
共有 12 个文件被更改,包括 1482 次插入 和 256 次删除
-
177Assets/Objects/boats/Prefabs/_Boat.prefab
-
35Assets/Scripts/Boat/BoatController.cs
-
55Assets/Scripts/Boat/HumanController.cs
-
430Assets/scenes/Island.unity
-
6Assets/scenes/Island/GlobalFX Profile.asset
-
7Packages/manifest.json
-
4ProjectSettings/ProjectSettings.asset
-
10ProjectSettings/TagManager.asset
-
421Assets/Data/New Controls.inputactions
-
14Assets/Data/New Controls.inputactions.meta
-
568Assets/Scripts/GameSystem/InputControls.cs
-
11Assets/Scripts/GameSystem/InputControls.cs.meta
|
|||
using UnityEngine; |
|||
using System.Collections; |
|||
/// <summary>
|
|||
/// This sends input controls to the boat engine if 'Human'
|
|||
/// </summary>
|
|||
/// <summary>
|
|||
/// This sends input controls to the boat engine if 'Human'
|
|||
/// </summary>
|
|||
|
|||
void Start() |
|||
public InputControls controls; |
|||
|
|||
public float throttle; |
|||
public float steering; |
|||
|
|||
void Awake() |
|||
controls = new InputControls(); |
|||
|
|||
controls.BoatControls.Trottle.performed += context => throttle = context.ReadValue<float>(); |
|||
controls.BoatControls.Trottle.canceled += context => throttle = 0f; |
|||
|
|||
controls.BoatControls.Steering.performed += context => steering = context.ReadValue<float>(); |
|||
controls.BoatControls.Steering.canceled += context => steering = 0f; |
|||
|
|||
private void OnEnable() |
|||
{ |
|||
controls.BoatControls.Enable(); |
|||
} |
|||
|
|||
private void OnDisable() |
|||
{ |
|||
controls.BoatControls.Disable(); |
|||
} |
|||
|
|||
////////////////////////////// Mobile controls - UNTESTED ////////////////////////////////
|
|||
foreach (Touch touch in Input.touches) // Acceleration
|
|||
{ |
|||
if (touch.position.x >= Screen.width * 0.8f && touch.position.y <= Screen.height * 0.3f) |
|||
engine.Accel(1.0f); |
|||
} |
|||
if(Input.acceleration.x != 0f) // Turning
|
|||
{ |
|||
engine.Turn(Input.acceleration.x * 2f); |
|||
} |
|||
/////////////////////////////// Desktop/Controller controls ///////////////////////////////
|
|||
if (Input.GetAxis("Accellerate") > 0.1f) // Acceleration
|
|||
{ |
|||
engine.Accel(1.0f); |
|||
} |
|||
float steer = Input.GetAxis("Horizontal"); |
|||
if (Mathf.Abs(steer) > 0.05f) // Turning
|
|||
{ |
|||
engine.Turn(steer); |
|||
} |
|||
engine.Accel(throttle); |
|||
engine.Turn(steering); |
|||
} |
|||
} |
|||
} |
|
|||
{ |
|||
"name": "New Controls", |
|||
"maps": [ |
|||
{ |
|||
"name": "BoatControls", |
|||
"id": "ef127e39-c6d2-4d6f-8edc-46296d5de0cb", |
|||
"actions": [ |
|||
{ |
|||
"name": "Trottle", |
|||
"id": "591093b7-743c-42e6-b71e-bab02d178bd1", |
|||
"expectedControlLayout": "Axis", |
|||
"continuous": true, |
|||
"passThrough": false, |
|||
"initialStateCheck": false, |
|||
"processors": "AxisDeadzone(min=0.1,max=1)", |
|||
"interactions": "", |
|||
"bindings": [] |
|||
}, |
|||
{ |
|||
"name": "Steering", |
|||
"id": "67e3403a-b3e8-43af-ab52-4575ba23afef", |
|||
"expectedControlLayout": "Axis", |
|||
"continuous": true, |
|||
"passThrough": false, |
|||
"initialStateCheck": false, |
|||
"processors": "AxisDeadzone(min=0.1,max=1)", |
|||
"interactions": "", |
|||
"bindings": [] |
|||
} |
|||
], |
|||
"bindings": [ |
|||
{ |
|||
"name": "Triggers", |
|||
"id": "3466fe24-0064-418d-9331-557be3fdcac4", |
|||
"path": "1DAxis", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "", |
|||
"action": "Trottle", |
|||
"isComposite": true, |
|||
"isPartOfComposite": false, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "negative", |
|||
"id": "eff0cde8-c5f9-43b6-86e8-8385017c8985", |
|||
"path": "<Gamepad>/leftTrigger", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Gamepad", |
|||
"action": "Trottle", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "positive", |
|||
"id": "e7382d1c-3b18-4582-9511-5569c858581e", |
|||
"path": "<Gamepad>/rightTrigger", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Gamepad", |
|||
"action": "Trottle", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "Buttons", |
|||
"id": "e1093b33-e798-4080-866e-f94010a4d7e0", |
|||
"path": "1DAxis", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "", |
|||
"action": "Trottle", |
|||
"isComposite": true, |
|||
"isPartOfComposite": false, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "negative", |
|||
"id": "b9957a1f-893b-4ee8-9579-667c3bb073d3", |
|||
"path": "<Gamepad>/buttonEast", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": ";Gamepad", |
|||
"action": "Trottle", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "positive", |
|||
"id": "de45f7f3-08ae-4508-a9d8-aca8191f35a1", |
|||
"path": "<Gamepad>/buttonSouth", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": ";Gamepad", |
|||
"action": "Trottle", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "Arrows", |
|||
"id": "4caeca52-a08d-469a-a986-778564c27c84", |
|||
"path": "1DAxis", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "", |
|||
"action": "Trottle", |
|||
"isComposite": true, |
|||
"isPartOfComposite": false, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "negative", |
|||
"id": "6b1d89c6-a8e7-4b32-9c05-f848bb1064a8", |
|||
"path": "<Keyboard>/downArrow", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Keyboard", |
|||
"action": "Trottle", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "positive", |
|||
"id": "b25a71de-239c-4d0a-8050-0169566cea38", |
|||
"path": "<Keyboard>/upArrow", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Keyboard", |
|||
"action": "Trottle", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "WSAD", |
|||
"id": "1d540095-a749-43de-89cd-2806255106e3", |
|||
"path": "1DAxis", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "", |
|||
"action": "Trottle", |
|||
"isComposite": true, |
|||
"isPartOfComposite": false, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "negative", |
|||
"id": "c59fc22d-e257-4273-9159-4416a56a15d0", |
|||
"path": "<Keyboard>/s", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Keyboard", |
|||
"action": "Trottle", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "positive", |
|||
"id": "a91b562c-2ac5-4d79-9a5b-1f2e59241e92", |
|||
"path": "<Keyboard>/w", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Keyboard", |
|||
"action": "Trottle", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "Alt", |
|||
"id": "edd450a3-5814-4902-80ec-bcc25edd0366", |
|||
"path": "1DAxis", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "", |
|||
"action": "Trottle", |
|||
"isComposite": true, |
|||
"isPartOfComposite": false, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "negative", |
|||
"id": "71ae2e67-e9b6-4a48-9669-38e7fe243cbc", |
|||
"path": "<Keyboard>/z", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Keyboard", |
|||
"action": "Trottle", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "positive", |
|||
"id": "a1291229-823b-4ede-82e6-090bc1bdfa21", |
|||
"path": "<Keyboard>/space", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Keyboard", |
|||
"action": "Trottle", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "", |
|||
"id": "30ce0b9b-3da0-420a-abc3-8f2040388953", |
|||
"path": "<Touchscreen>/touch/position/y", |
|||
"interactions": "", |
|||
"processors": "Clamp(min=-1,max=1)", |
|||
"groups": "TouchScreen", |
|||
"action": "Trottle", |
|||
"isComposite": false, |
|||
"isPartOfComposite": false, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "LeftThumbstick", |
|||
"id": "01df8425-ce9a-4024-bad4-0f5e8002094f", |
|||
"path": "1DAxis", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "", |
|||
"action": "Steering", |
|||
"isComposite": true, |
|||
"isPartOfComposite": false, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "negative", |
|||
"id": "3866264b-46e4-428b-9624-ada67f2de7bd", |
|||
"path": "<Gamepad>/leftStick/left", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Gamepad", |
|||
"action": "Steering", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "positive", |
|||
"id": "9a637b8c-8d48-42f2-9cef-114e3b8bb2ba", |
|||
"path": "<Gamepad>/leftStick/right", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Gamepad", |
|||
"action": "Steering", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "DPad", |
|||
"id": "8aeee6b0-abef-4b03-a8b3-e592682ef6ac", |
|||
"path": "1DAxis", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "", |
|||
"action": "Steering", |
|||
"isComposite": true, |
|||
"isPartOfComposite": false, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "negative", |
|||
"id": "52a3b81b-20a0-4d9a-a700-4b0941383170", |
|||
"path": "<Gamepad>/dpad/left", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": ";Gamepad", |
|||
"action": "Steering", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "positive", |
|||
"id": "3406ab27-525e-47ca-84d5-25e0a5a83c29", |
|||
"path": "<Gamepad>/dpad/right", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": ";Gamepad", |
|||
"action": "Steering", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "Arrows", |
|||
"id": "b5b408fa-df11-4ebc-b589-5ff03be94ba1", |
|||
"path": "1DAxis", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "", |
|||
"action": "Steering", |
|||
"isComposite": true, |
|||
"isPartOfComposite": false, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "negative", |
|||
"id": "010e7196-f4dd-4d5c-8f42-f47f3984bc01", |
|||
"path": "<Keyboard>/leftArrow", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Keyboard", |
|||
"action": "Steering", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "positive", |
|||
"id": "36de1a52-c485-4d40-8d4d-323d8fe73445", |
|||
"path": "<Keyboard>/rightArrow", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Keyboard", |
|||
"action": "Steering", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "WSAD", |
|||
"id": "24d9ae40-f8f8-4a39-abbe-68ce064083f8", |
|||
"path": "1DAxis", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "", |
|||
"action": "Steering", |
|||
"isComposite": true, |
|||
"isPartOfComposite": false, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "negative", |
|||
"id": "c07695cd-a24b-4ba5-8162-fd6c1d55667a", |
|||
"path": "<Keyboard>/a", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Keyboard", |
|||
"action": "Steering", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "positive", |
|||
"id": "72970fc1-f5b9-4e7b-bfb0-8356935a6274", |
|||
"path": "<Keyboard>/d", |
|||
"interactions": "", |
|||
"processors": "", |
|||
"groups": "Keyboard", |
|||
"action": "Steering", |
|||
"isComposite": false, |
|||
"isPartOfComposite": true, |
|||
"modifiers": "" |
|||
}, |
|||
{ |
|||
"name": "", |
|||
"id": "3d3dbb25-9147-4e77-ae9d-04d1c01d2666", |
|||
"path": "<Touchscreen>/tilt/x", |
|||
"interactions": "", |
|||
"processors": "Clamp(min=-1,max=1)", |
|||
"groups": "TouchScreen", |
|||
"action": "Steering", |
|||
"isComposite": false, |
|||
"isPartOfComposite": false, |
|||
"modifiers": "" |
|||
} |
|||
] |
|||
} |
|||
], |
|||
"controlSchemes": [ |
|||
{ |
|||
"name": "Gamepad", |
|||
"basedOn": "", |
|||
"bindingGroup": "Gamepad", |
|||
"devices": [ |
|||
{ |
|||
"devicePath": "<Gamepad>", |
|||
"isOptional": false, |
|||
"isOR": false |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
"name": "Keyboard", |
|||
"basedOn": "", |
|||
"bindingGroup": "Keyboard", |
|||
"devices": [ |
|||
{ |
|||
"devicePath": "<Keyboard>", |
|||
"isOptional": false, |
|||
"isOR": false |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
"name": "TouchScreen", |
|||
"basedOn": "", |
|||
"bindingGroup": "TouchScreen", |
|||
"devices": [ |
|||
{ |
|||
"devicePath": "<Touchscreen>", |
|||
"isOptional": false, |
|||
"isOR": false |
|||
} |
|||
] |
|||
} |
|||
] |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 216207ae924c39842b5b2ad515311cfa |
|||
ScriptedImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} |
|||
generateWrapperCode: 1 |
|||
wrapperCodePath: Assets/Scripts/GameSystem/InputControls.cs |
|||
wrapperClassName: InputControls |
|||
wrapperCodeNamespace: |
|
|||
// GENERATED AUTOMATICALLY FROM 'Assets/Data/New Controls.inputactions'
|
|||
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.InputSystem; |
|||
using UnityEngine.InputSystem.Utilities; |
|||
|
|||
public class InputControls : IInputActionCollection |
|||
{ |
|||
private InputActionAsset asset; |
|||
public InputControls() |
|||
{ |
|||
asset = InputActionAsset.FromJson(@"{
|
|||
""name"": ""New Controls"", |
|||
""maps"": [ |
|||
{ |
|||
""name"": ""BoatControls"", |
|||
""id"": ""ef127e39-c6d2-4d6f-8edc-46296d5de0cb"", |
|||
""actions"": [ |
|||
{ |
|||
""name"": ""Trottle"", |
|||
""id"": ""591093b7-743c-42e6-b71e-bab02d178bd1"", |
|||
""expectedControlLayout"": ""Axis"", |
|||
""continuous"": true, |
|||
""passThrough"": false, |
|||
""initialStateCheck"": false, |
|||
""processors"": ""AxisDeadzone(min=0.1,max=1)"", |
|||
""interactions"": """", |
|||
""bindings"": [] |
|||
}, |
|||
{ |
|||
""name"": ""Steering"", |
|||
""id"": ""67e3403a-b3e8-43af-ab52-4575ba23afef"", |
|||
""expectedControlLayout"": ""Axis"", |
|||
""continuous"": true, |
|||
""passThrough"": false, |
|||
""initialStateCheck"": false, |
|||
""processors"": ""AxisDeadzone(min=0.1,max=1)"", |
|||
""interactions"": """", |
|||
""bindings"": [] |
|||
} |
|||
], |
|||
""bindings"": [ |
|||
{ |
|||
""name"": ""Triggers"", |
|||
""id"": ""3466fe24-0064-418d-9331-557be3fdcac4"", |
|||
""path"": ""1DAxis"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": """", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": true, |
|||
""isPartOfComposite"": false, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""negative"", |
|||
""id"": ""eff0cde8-c5f9-43b6-86e8-8385017c8985"", |
|||
""path"": ""<Gamepad>/leftTrigger"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Gamepad"", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""positive"", |
|||
""id"": ""e7382d1c-3b18-4582-9511-5569c858581e"", |
|||
""path"": ""<Gamepad>/rightTrigger"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Gamepad"", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""Buttons"", |
|||
""id"": ""e1093b33-e798-4080-866e-f94010a4d7e0"", |
|||
""path"": ""1DAxis"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": """", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": true, |
|||
""isPartOfComposite"": false, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""negative"", |
|||
""id"": ""b9957a1f-893b-4ee8-9579-667c3bb073d3"", |
|||
""path"": ""<Gamepad>/buttonEast"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": "";Gamepad"", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""positive"", |
|||
""id"": ""de45f7f3-08ae-4508-a9d8-aca8191f35a1"", |
|||
""path"": ""<Gamepad>/buttonSouth"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": "";Gamepad"", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""Arrows"", |
|||
""id"": ""4caeca52-a08d-469a-a986-778564c27c84"", |
|||
""path"": ""1DAxis"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": """", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": true, |
|||
""isPartOfComposite"": false, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""negative"", |
|||
""id"": ""6b1d89c6-a8e7-4b32-9c05-f848bb1064a8"", |
|||
""path"": ""<Keyboard>/downArrow"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Keyboard"", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""positive"", |
|||
""id"": ""b25a71de-239c-4d0a-8050-0169566cea38"", |
|||
""path"": ""<Keyboard>/upArrow"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Keyboard"", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""WSAD"", |
|||
""id"": ""1d540095-a749-43de-89cd-2806255106e3"", |
|||
""path"": ""1DAxis"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": """", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": true, |
|||
""isPartOfComposite"": false, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""negative"", |
|||
""id"": ""c59fc22d-e257-4273-9159-4416a56a15d0"", |
|||
""path"": ""<Keyboard>/s"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Keyboard"", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""positive"", |
|||
""id"": ""a91b562c-2ac5-4d79-9a5b-1f2e59241e92"", |
|||
""path"": ""<Keyboard>/w"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Keyboard"", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""Alt"", |
|||
""id"": ""edd450a3-5814-4902-80ec-bcc25edd0366"", |
|||
""path"": ""1DAxis"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": """", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": true, |
|||
""isPartOfComposite"": false, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""negative"", |
|||
""id"": ""71ae2e67-e9b6-4a48-9669-38e7fe243cbc"", |
|||
""path"": ""<Keyboard>/z"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Keyboard"", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""positive"", |
|||
""id"": ""a1291229-823b-4ede-82e6-090bc1bdfa21"", |
|||
""path"": ""<Keyboard>/space"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Keyboard"", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": """", |
|||
""id"": ""30ce0b9b-3da0-420a-abc3-8f2040388953"", |
|||
""path"": ""<Touchscreen>/touch/position/y"", |
|||
""interactions"": """", |
|||
""processors"": ""Clamp(min=-1,max=1)"", |
|||
""groups"": ""TouchScreen"", |
|||
""action"": ""Trottle"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": false, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""LeftThumbstick"", |
|||
""id"": ""01df8425-ce9a-4024-bad4-0f5e8002094f"", |
|||
""path"": ""1DAxis"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": """", |
|||
""action"": ""Steering"", |
|||
""isComposite"": true, |
|||
""isPartOfComposite"": false, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""negative"", |
|||
""id"": ""3866264b-46e4-428b-9624-ada67f2de7bd"", |
|||
""path"": ""<Gamepad>/leftStick/left"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Gamepad"", |
|||
""action"": ""Steering"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""positive"", |
|||
""id"": ""9a637b8c-8d48-42f2-9cef-114e3b8bb2ba"", |
|||
""path"": ""<Gamepad>/leftStick/right"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Gamepad"", |
|||
""action"": ""Steering"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""DPad"", |
|||
""id"": ""8aeee6b0-abef-4b03-a8b3-e592682ef6ac"", |
|||
""path"": ""1DAxis"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": """", |
|||
""action"": ""Steering"", |
|||
""isComposite"": true, |
|||
""isPartOfComposite"": false, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""negative"", |
|||
""id"": ""52a3b81b-20a0-4d9a-a700-4b0941383170"", |
|||
""path"": ""<Gamepad>/dpad/left"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": "";Gamepad"", |
|||
""action"": ""Steering"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""positive"", |
|||
""id"": ""3406ab27-525e-47ca-84d5-25e0a5a83c29"", |
|||
""path"": ""<Gamepad>/dpad/right"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": "";Gamepad"", |
|||
""action"": ""Steering"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""Arrows"", |
|||
""id"": ""b5b408fa-df11-4ebc-b589-5ff03be94ba1"", |
|||
""path"": ""1DAxis"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": """", |
|||
""action"": ""Steering"", |
|||
""isComposite"": true, |
|||
""isPartOfComposite"": false, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""negative"", |
|||
""id"": ""010e7196-f4dd-4d5c-8f42-f47f3984bc01"", |
|||
""path"": ""<Keyboard>/leftArrow"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Keyboard"", |
|||
""action"": ""Steering"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""positive"", |
|||
""id"": ""36de1a52-c485-4d40-8d4d-323d8fe73445"", |
|||
""path"": ""<Keyboard>/rightArrow"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Keyboard"", |
|||
""action"": ""Steering"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""WSAD"", |
|||
""id"": ""24d9ae40-f8f8-4a39-abbe-68ce064083f8"", |
|||
""path"": ""1DAxis"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": """", |
|||
""action"": ""Steering"", |
|||
""isComposite"": true, |
|||
""isPartOfComposite"": false, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""negative"", |
|||
""id"": ""c07695cd-a24b-4ba5-8162-fd6c1d55667a"", |
|||
""path"": ""<Keyboard>/a"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Keyboard"", |
|||
""action"": ""Steering"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": ""positive"", |
|||
""id"": ""72970fc1-f5b9-4e7b-bfb0-8356935a6274"", |
|||
""path"": ""<Keyboard>/d"", |
|||
""interactions"": """", |
|||
""processors"": """", |
|||
""groups"": ""Keyboard"", |
|||
""action"": ""Steering"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": true, |
|||
""modifiers"": """" |
|||
}, |
|||
{ |
|||
""name"": """", |
|||
""id"": ""3d3dbb25-9147-4e77-ae9d-04d1c01d2666"", |
|||
""path"": ""<Touchscreen>/tilt/x"", |
|||
""interactions"": """", |
|||
""processors"": ""Clamp(min=-1,max=1)"", |
|||
""groups"": ""TouchScreen"", |
|||
""action"": ""Steering"", |
|||
""isComposite"": false, |
|||
""isPartOfComposite"": false, |
|||
""modifiers"": """" |
|||
} |
|||
] |
|||
} |
|||
], |
|||
""controlSchemes"": [ |
|||
{ |
|||
""name"": ""Gamepad"", |
|||
""basedOn"": """", |
|||
""bindingGroup"": ""Gamepad"", |
|||
""devices"": [ |
|||
{ |
|||
""devicePath"": ""<Gamepad>"", |
|||
""isOptional"": false, |
|||
""isOR"": false |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
""name"": ""Keyboard"", |
|||
""basedOn"": """", |
|||
""bindingGroup"": ""Keyboard"", |
|||
""devices"": [ |
|||
{ |
|||
""devicePath"": ""<Keyboard>"", |
|||
""isOptional"": false, |
|||
""isOR"": false |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
""name"": ""TouchScreen"", |
|||
""basedOn"": """", |
|||
""bindingGroup"": ""TouchScreen"", |
|||
""devices"": [ |
|||
{ |
|||
""devicePath"": ""<Touchscreen>"", |
|||
""isOptional"": false, |
|||
""isOR"": false |
|||
} |
|||
] |
|||
} |
|||
] |
|||
}");
|
|||
// BoatControls
|
|||
m_BoatControls = asset.GetActionMap("BoatControls"); |
|||
m_BoatControls_Trottle = m_BoatControls.GetAction("Trottle"); |
|||
m_BoatControls_Steering = m_BoatControls.GetAction("Steering"); |
|||
} |
|||
|
|||
~InputControls() |
|||
{ |
|||
UnityEngine.Object.Destroy(asset); |
|||
} |
|||
|
|||
public InputBinding? bindingMask |
|||
{ |
|||
get => asset.bindingMask; |
|||
set => asset.bindingMask = value; |
|||
} |
|||
|
|||
public ReadOnlyArray<InputDevice>? devices |
|||
{ |
|||
get => asset.devices; |
|||
set => asset.devices = value; |
|||
} |
|||
|
|||
public ReadOnlyArray<InputControlScheme> controlSchemes |
|||
{ |
|||
get => asset.controlSchemes; |
|||
} |
|||
|
|||
public bool Contains(InputAction action) |
|||
{ |
|||
return asset.Contains(action); |
|||
} |
|||
|
|||
public IEnumerator<InputAction> GetEnumerator() |
|||
{ |
|||
return asset.GetEnumerator(); |
|||
} |
|||
|
|||
IEnumerator IEnumerable.GetEnumerator() |
|||
{ |
|||
return GetEnumerator(); |
|||
} |
|||
|
|||
public void Enable() |
|||
{ |
|||
asset.Enable(); |
|||
} |
|||
|
|||
public void Disable() |
|||
{ |
|||
asset.Disable(); |
|||
} |
|||
|
|||
// BoatControls
|
|||
private InputActionMap m_BoatControls; |
|||
private IBoatControlsActions m_BoatControlsActionsCallbackInterface; |
|||
private InputAction m_BoatControls_Trottle; |
|||
private InputAction m_BoatControls_Steering; |
|||
public struct BoatControlsActions |
|||
{ |
|||
private InputControls m_Wrapper; |
|||
public BoatControlsActions(InputControls wrapper) { m_Wrapper = wrapper; } |
|||
public InputAction @Trottle { get { return m_Wrapper.m_BoatControls_Trottle; } } |
|||
public InputAction @Steering { get { return m_Wrapper.m_BoatControls_Steering; } } |
|||
public InputActionMap Get() { return m_Wrapper.m_BoatControls; } |
|||
public void Enable() { Get().Enable(); } |
|||
public void Disable() { Get().Disable(); } |
|||
public bool enabled { get { return Get().enabled; } } |
|||
public InputActionMap Clone() { return Get().Clone(); } |
|||
public static implicit operator InputActionMap(BoatControlsActions set) { return set.Get(); } |
|||
public void SetCallbacks(IBoatControlsActions instance) |
|||
{ |
|||
if (m_Wrapper.m_BoatControlsActionsCallbackInterface != null) |
|||
{ |
|||
Trottle.started -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnTrottle; |
|||
Trottle.performed -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnTrottle; |
|||
Trottle.canceled -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnTrottle; |
|||
Steering.started -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnSteering; |
|||
Steering.performed -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnSteering; |
|||
Steering.canceled -= m_Wrapper.m_BoatControlsActionsCallbackInterface.OnSteering; |
|||
} |
|||
m_Wrapper.m_BoatControlsActionsCallbackInterface = instance; |
|||
if (instance != null) |
|||
{ |
|||
Trottle.started += instance.OnTrottle; |
|||
Trottle.performed += instance.OnTrottle; |
|||
Trottle.canceled += instance.OnTrottle; |
|||
Steering.started += instance.OnSteering; |
|||
Steering.performed += instance.OnSteering; |
|||
Steering.canceled += instance.OnSteering; |
|||
} |
|||
} |
|||
} |
|||
public BoatControlsActions @BoatControls |
|||
{ |
|||
get |
|||
{ |
|||
return new BoatControlsActions(this); |
|||
} |
|||
} |
|||
private int m_GamepadSchemeIndex = -1; |
|||
public InputControlScheme GamepadScheme |
|||
{ |
|||
get |
|||
{ |
|||
if (m_GamepadSchemeIndex == -1) m_GamepadSchemeIndex = asset.GetControlSchemeIndex("Gamepad"); |
|||
return asset.controlSchemes[m_GamepadSchemeIndex]; |
|||
} |
|||
} |
|||
private int m_KeyboardSchemeIndex = -1; |
|||
public InputControlScheme KeyboardScheme |
|||
{ |
|||
get |
|||
{ |
|||
if (m_KeyboardSchemeIndex == -1) m_KeyboardSchemeIndex = asset.GetControlSchemeIndex("Keyboard"); |
|||
return asset.controlSchemes[m_KeyboardSchemeIndex]; |
|||
} |
|||
} |
|||
private int m_TouchScreenSchemeIndex = -1; |
|||
public InputControlScheme TouchScreenScheme |
|||
{ |
|||
get |
|||
{ |
|||
if (m_TouchScreenSchemeIndex == -1) m_TouchScreenSchemeIndex = asset.GetControlSchemeIndex("TouchScreen"); |
|||
return asset.controlSchemes[m_TouchScreenSchemeIndex]; |
|||
} |
|||
} |
|||
public interface IBoatControlsActions |
|||
{ |
|||
void OnTrottle(InputAction.CallbackContext context); |
|||
void OnSteering(InputAction.CallbackContext context); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 28f3f037f6ca67c4d8b3c6ac364642e6 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue