浏览代码

Input and Camera tweaking

/main
Ciro Continisio 4 年前
当前提交
f6be0d86
共有 7 个文件被更改,包括 76 次插入27 次删除
  1. 20
      UOP1_Project/Assets/Prefabs/GameplayEssentials/CameraSystem.prefab
  2. 18
      UOP1_Project/Assets/Scripts/CameraManager.cs
  3. 13
      UOP1_Project/Assets/Scripts/Input/GameInput.cs
  4. 13
      UOP1_Project/Assets/Settings/Input/GameInput.inputactions
  5. 2
      UOP1_Project/ProjectSettings/EditorBuildSettings.asset
  6. 29
      UOP1_Project/Assets/Settings/Input/InputSystem.inputsettings.asset
  7. 8
      UOP1_Project/Assets/Settings/Input/InputSystem.inputsettings.asset.meta

20
UOP1_Project/Assets/Prefabs/GameplayEssentials/CameraSystem.prefab


m_Script: {fileID: 11500000, guid: 9384ab8608cdc3d479fe89cd51eed48f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 4
m_BindingMode: 5
m_FollowOffset: {x: 0, y: 7, z: -12}
m_XDamping: 1
m_YDamping: 1

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1988373824387590796}
m_LocalRotation: {x: 0.22975291, y: 1e-45, z: -0, w: 0.973249}
m_LocalRotation: {x: 0.22975291, y: -0, z: -0, w: 0.973249}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:

m_Script: {fileID: 11500000, guid: 9384ab8608cdc3d479fe89cd51eed48f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 4
m_BindingMode: 5
m_FollowOffset: {x: 0, y: 7, z: -12}
m_XDamping: 0.1
m_YDamping: 0.1

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5457523176376150323}
m_LocalRotation: {x: 0.22975291, y: 1e-45, z: -0, w: 0.973249}
m_LocalRotation: {x: 0.22975291, y: -9.602319e-22, z: 2.8636668e-22, w: 0.973249}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:

m_Script: {fileID: 11500000, guid: 9384ab8608cdc3d479fe89cd51eed48f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 4
m_BindingMode: 5
m_FollowOffset: {x: 0, y: 7, z: -12}
m_XDamping: 1
m_YDamping: 1

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6333144650067166509}
m_LocalRotation: {x: 0.22975291, y: 1e-45, z: -0, w: 0.973249}
m_LocalRotation: {x: 0.22975291, y: -0, z: -0, w: 0.973249}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:

inputReader: {fileID: 11400000, guid: 945ec0365077176418488737deed54be, type: 2}
mainCamera: {fileID: 8745341642014614481}
freeLookVCam: {fileID: 8745341641394998849}
speed: 2
_speedMultiplier: 1
_cameraTransformAnchor: {fileID: 11400000, guid: bc205269957643647a8b5f98f028f9fb,
type: 2}
_frameObjectChannel: {fileID: 11400000, guid: 2723b3f59f7ede3498fe7e385d2bb6ee,

m_XAxis:
Value: 0
m_SpeedMode: 0
m_MaxSpeed: 3000
m_MaxSpeed: 5000
m_AccelTime: 0.5
m_DecelTime: 0.1
m_InputAxisName:

m_RecenteringTime: 10
m_LegacyHeadingDefinition: -1
m_LegacyVelocityFilterStrength: -1
m_BindingMode: 4
m_BindingMode: 5
m_SplineCurvature: 1
m_Orbits:
- m_Height: 15

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8745341642014614487}
m_LocalRotation: {x: 0.22975294, y: 1e-45, z: -0, w: 0.973249}
m_LocalRotation: {x: 0.22975294, y: -0, z: -0, w: 0.973249}
m_LocalPosition: {x: 0, y: 7, z: -12}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []

18
UOP1_Project/Assets/Scripts/CameraManager.cs


public CinemachineFreeLook freeLookVCam;
private bool _isRMBPressed;
[SerializeField, Range(1f, 5f)]
private float speed = default;
[SerializeField, Range(.5f, 3f)]
private float _speedMultiplier = 1f; //TODO: make this modifiable in the game settings
[SerializeField] private TransformAnchor _cameraTransformAnchor = default;
[Header("Listening on channels")]

private bool cameraMovementLock = false;
private bool _cameraMovementLock = false;
public void SetupProtagonistVirtualCamera(Transform target)
{

IEnumerator DisableMouseControlForFrame()
{
cameraMovementLock = true;
_cameraMovementLock = true;
cameraMovementLock = false;
_cameraMovementLock = false;
}
private void OnDisableMouseControlCamera()

private void OnCameraMove(Vector2 cameraMovement, bool isDeviceMouse)
{
if (cameraMovementLock)
Debug.Log(cameraMovement);
if (_cameraMovementLock)
freeLookVCam.m_XAxis.m_InputAxisValue = cameraMovement.x * Time.smoothDeltaTime * speed * 0.2f;
freeLookVCam.m_YAxis.m_InputAxisValue = cameraMovement.y * Time.smoothDeltaTime * speed * 0.2f;
freeLookVCam.m_XAxis.m_InputAxisValue = cameraMovement.x * Time.smoothDeltaTime * _speedMultiplier;
freeLookVCam.m_YAxis.m_InputAxisValue = cameraMovement.y * Time.smoothDeltaTime * _speedMultiplier;
}
private void OnFrameObjectEvent(Transform value)

13
UOP1_Project/Assets/Scripts/Input/GameInput.cs


""id"": ""2b832572-50ef-4dba-aaeb-964ed1c854bb"",
""path"": ""<Gamepad>/rightStick"",
""interactions"": """",
""processors"": ""ScaleVector2(x=2,y=2)"",
""processors"": ""StickDeadzone,ScaleVector2(x=8,y=8)"",
""groups"": ""KeyboardOrGamepad"",
""action"": ""RotateCamera"",
""isComposite"": false,

""name"": ""Keyboard TFGH"",
""id"": ""8e17360e-f036-4963-93f6-05d14787dfb5"",
""path"": ""2DVector"",
""path"": ""2DVector(mode=1)"",
""processors"": ""ScaleVector2(x=2,y=2)"",
""processors"": ""ScaleVector2(x=8,y=8)"",
""groups"": """",
""action"": ""RotateCamera"",
""isComposite"": true,

""id"": ""88e5a69d-cf1d-43ce-b5ab-9db67f819255"",
""path"": ""<Mouse>/delta"",
""interactions"": """",
""processors"": ""ScaleVector2"",
""processors"": ""ScaleVector2(x=2,y=2)"",
""groups"": ""KeyboardOrGamepad"",
""action"": ""RotateCamera"",
""isComposite"": false,

},
{
""devicePath"": ""<Keyboard>"",
""isOptional"": false,
""isOR"": false
},
{
""devicePath"": ""<Mouse>"",
""isOptional"": false,
""isOR"": false
}

13
UOP1_Project/Assets/Settings/Input/GameInput.inputactions


"id": "2b832572-50ef-4dba-aaeb-964ed1c854bb",
"path": "<Gamepad>/rightStick",
"interactions": "",
"processors": "ScaleVector2(x=2,y=2)",
"processors": "StickDeadzone,ScaleVector2(x=8,y=8)",
"groups": "KeyboardOrGamepad",
"action": "RotateCamera",
"isComposite": false,

"name": "Keyboard TFGH",
"id": "8e17360e-f036-4963-93f6-05d14787dfb5",
"path": "2DVector",
"path": "2DVector(mode=1)",
"processors": "ScaleVector2(x=2,y=2)",
"processors": "ScaleVector2(x=8,y=8)",
"groups": "",
"action": "RotateCamera",
"isComposite": true,

"id": "88e5a69d-cf1d-43ce-b5ab-9db67f819255",
"path": "<Mouse>/delta",
"interactions": "",
"processors": "ScaleVector2",
"processors": "ScaleVector2(x=2,y=2)",
"groups": "KeyboardOrGamepad",
"action": "RotateCamera",
"isComposite": false,

},
{
"devicePath": "<Keyboard>",
"isOptional": false,
"isOR": false
},
{
"devicePath": "<Mouse>",
"isOptional": false,
"isOR": false
}

2
UOP1_Project/ProjectSettings/EditorBuildSettings.asset


m_configObjects:
com.unity.addressableassets: {fileID: 11400000, guid: 758daf1c1b96e4978a5b9b3f5815abf1,
type: 2}
com.unity.input.settings: {fileID: 11400000, guid: d65f543d6791541829742d101f33aedb,
com.unity.input.settings: {fileID: 11400000, guid: bf2387135d5fdc745b74293cd27573be,
type: 2}
com.unity.localization.settings: {fileID: 11400000, guid: 56b1c58ec65bd4151b3054a32d1f7b69,
type: 2}

29
UOP1_Project/Assets/Settings/Input/InputSystem.inputsettings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c46f07b5ed07e4e92aa78254188d3d10, type: 3}
m_Name: InputSystem.inputsettings
m_EditorClassIdentifier:
m_SupportedDevices:
- Keyboard
- Mouse
- Gamepad
m_UpdateMode: 1
m_CompensateForScreenOrientation: 1
m_FilterNoiseOnCurrent: 0
m_DefaultDeadzoneMin: 0.1
m_DefaultDeadzoneMax: 1
m_DefaultButtonPressPoint: 0.5
m_DefaultTapTime: 0.2
m_DefaultSlowTapTime: 0.5
m_DefaultHoldTime: 0.4
m_TapRadius: 5
m_MultiTapDelayTime: 0.75

8
UOP1_Project/Assets/Settings/Input/InputSystem.inputsettings.asset.meta


fileFormatVersion: 2
guid: bf2387135d5fdc745b74293cd27573be
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存