From 13ccde8e9601af015d7693851aec096628070138 Mon Sep 17 00:00:00 2001 From: Dan Foster Date: Thu, 12 Feb 2026 00:02:53 +0000 Subject: [PATCH] Moving some things over to the InputData system. --- Assets/Prefabs/Player.prefab | 110 ++++++++++++++-- Assets/Scenes/Testing Scenes/Movement.unity | 139 +------------------- Assets/Scripts/Game/Input/InputData.cs | 130 +++--------------- Assets/Scripts/InputHelper.cs | 9 ++ Assets/Scripts/InputHelper.cs.meta | 11 ++ Assets/Scripts/SimpleGun.cs | 4 +- 6 files changed, 142 insertions(+), 261 deletions(-) create mode 100644 Assets/Scripts/InputHelper.cs create mode 100644 Assets/Scripts/InputHelper.cs.meta diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 09d3899..d8ff305 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -9,11 +9,13 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 8110894233409421727} + - component: {fileID: 9204028306768623378} - component: {fileID: 126029702024624554} - component: {fileID: 3002660132190180648} - component: {fileID: 4383523072808109851} - component: {fileID: 3609363995277177833} - component: {fileID: 5383724707706325514} + - component: {fileID: 7449172431108916039} m_Layer: 0 m_Name: Player m_TagString: Untagged @@ -37,6 +39,18 @@ Transform: - {fileID: 4867483367381507360} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &9204028306768623378 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6882903375964528458} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: deeb0d245b10479488cdc39099cb9bab, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::InputHelper --- !u!143 &126029702024624554 CharacterController: m_ObjectHideFlags: 0 @@ -112,7 +126,7 @@ MeshRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6882903375964528458} m_Enabled: 1 - m_CastShadows: 1 + m_CastShadows: 0 m_ReceiveShadows: 1 m_DynamicOccludee: 1 m_StaticShadowCaster: 0 @@ -129,7 +143,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 2100000, guid: 934901a6cc251ea4cb28620f9a14909e, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -153,6 +167,19 @@ MeshRenderer: m_SortingOrder: 0 m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} +--- !u!114 &7449172431108916039 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6882903375964528458} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f9e99d5848b80d246b6540ad0aabf4d8, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::Player + health: 100 --- !u!1 &8543759782269834926 GameObject: m_ObjectHideFlags: 0 @@ -165,6 +192,7 @@ GameObject: - component: {fileID: 2075247097621853228} - component: {fileID: 6877818284364034329} - component: {fileID: 8719656586330480197} + - component: {fileID: 8595194069415729003} m_Layer: 0 m_Name: Camera m_TagString: Untagged @@ -259,6 +287,50 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9ad5c2eb6d6ecad47af3a531cd239ec5, type: 3} m_Name: m_EditorClassIdentifier: Assembly-CSharp::CameraShake +--- !u!114 &8595194069415729003 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8543759782269834926} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.UniversalAdditionalCameraData + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_VolumeFrameworkUpdateModeOption: 2 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_TaaSettings: + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 --- !u!1001 &1420362106600511514 PrefabInstance: m_ObjectHideFlags: 0 @@ -271,45 +343,57 @@ PrefabInstance: propertyPath: m_Name value: Gun Splat objectReference: {fileID: 0} + - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} + propertyPath: m_LocalScale.x + value: 1.2387 + objectReference: {fileID: 0} + - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} + propertyPath: m_LocalScale.y + value: 1.2387 + objectReference: {fileID: 0} + - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} + propertyPath: m_LocalScale.z + value: 1.2387 + objectReference: {fileID: 0} - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} propertyPath: m_LocalPosition.x - value: -0.05 + value: -0.079 objectReference: {fileID: 0} - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} propertyPath: m_LocalPosition.y - value: -0.0791769 + value: -0.1367 objectReference: {fileID: 0} - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} propertyPath: m_LocalPosition.z - value: 0.755 + value: 0.7986 objectReference: {fileID: 0} - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} propertyPath: m_LocalRotation.w - value: 0.9211828 + value: 0.8836397 objectReference: {fileID: 0} - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} propertyPath: m_LocalRotation.x - value: -0.30416393 + value: -0.24749401 objectReference: {fileID: 0} - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} propertyPath: m_LocalRotation.y - value: -0.21869422 + value: -0.3881987 objectReference: {fileID: 0} - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} propertyPath: m_LocalRotation.z - value: 0.105259016 + value: 0.08502574 objectReference: {fileID: 0} - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} propertyPath: m_LocalEulerAnglesHint.x - value: -30.954 + value: -21.801 objectReference: {fileID: 0} - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} propertyPath: m_LocalEulerAnglesHint.y - value: -32.99 + value: -51.649 objectReference: {fileID: 0} - target: {fileID: 3447742079981357586, guid: 4f15ea45bfb5e4f11bc2bce50e39fc10, type: 3} propertyPath: m_LocalEulerAnglesHint.z - value: 22.412 + value: 21.641 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -341,7 +425,7 @@ MonoBehaviour: fireRate: 8 maxAmmo: 30 currentAmmo: 0 - isAutomatic: 1 + isAutomatic: 0 recoilKickback: 0.08 recoilKickUp: 0.04 recoilRecoverySpeed: 12 diff --git a/Assets/Scenes/Testing Scenes/Movement.unity b/Assets/Scenes/Testing Scenes/Movement.unity index c8cbb6c..6774cbd 100644 --- a/Assets/Scenes/Testing Scenes/Movement.unity +++ b/Assets/Scenes/Testing Scenes/Movement.unity @@ -230,70 +230,10 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalScale.x - value: 1.2387 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalScale.y - value: 1.2387 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalScale.z - value: 1.2387 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalPosition.x - value: -0.079 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalPosition.y - value: -0.1367 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalPosition.z - value: 0.7986 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalRotation.w - value: 0.8836397 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalRotation.x - value: -0.24749401 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalRotation.y - value: -0.3881987 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalRotation.z - value: 0.08502574 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: -21.801 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: -51.649 - objectReference: {fileID: 0} - - target: {fileID: 4354687167556866568, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 21.641 - objectReference: {fileID: 0} - - target: {fileID: 5383724707706325514, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_Enabled - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5383724707706325514, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: m_CastShadows + - target: {fileID: 1440475385873073364, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} + propertyPath: isAutomatic value: 0 objectReference: {fileID: 0} - - target: {fileID: 5383724707706325514, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: 934901a6cc251ea4cb28620f9a14909e, type: 2} - target: {fileID: 6882903375964528458, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} propertyPath: m_Name value: Player @@ -341,13 +281,7 @@ PrefabInstance: m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: - - targetCorrespondingSourceObject: {fileID: 6882903375964528458, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - insertIndex: -1 - addedObject: {fileID: 1221260112} - - targetCorrespondingSourceObject: {fileID: 8543759782269834926, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - insertIndex: -1 - addedObject: {fileID: 454108990} + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} --- !u!1001 &197010634 PrefabInstance: @@ -6342,55 +6276,6 @@ Transform: m_Children: [] m_Father: {fileID: 1716472518} m_LocalEulerAnglesHint: {x: 0, y: -176, z: 0} ---- !u!1 &454108985 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 8543759782269834926, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - m_PrefabInstance: {fileID: 110786869} - m_PrefabAsset: {fileID: 0} ---- !u!114 &454108990 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 454108985} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} - m_Name: - m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.UniversalAdditionalCameraData - m_RenderShadows: 1 - m_RequiresDepthTextureOption: 2 - m_RequiresOpaqueTextureOption: 2 - m_CameraType: 0 - m_Cameras: [] - m_RendererIndex: -1 - m_VolumeLayerMask: - serializedVersion: 2 - m_Bits: 1 - m_VolumeTrigger: {fileID: 0} - m_VolumeFrameworkUpdateModeOption: 2 - m_RenderPostProcessing: 0 - m_Antialiasing: 0 - m_AntialiasingQuality: 2 - m_StopNaN: 0 - m_Dithering: 0 - m_ClearDepth: 1 - m_AllowXRRendering: 1 - m_AllowHDROutput: 1 - m_UseScreenCoordOverride: 0 - m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} - m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} - m_RequiresDepthTexture: 0 - m_RequiresColorTexture: 0 - m_TaaSettings: - m_Quality: 3 - m_FrameInfluence: 0.1 - m_JitterScale: 1 - m_MipBias: 0 - m_VarianceClampScale: 0.9 - m_ContrastAdaptiveSharpening: 0 - m_Version: 2 --- !u!1001 &483729265 PrefabInstance: m_ObjectHideFlags: 0 @@ -7318,24 +7203,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1221260105 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 6882903375964528458, guid: 33de4b621d70a49aab5df775f2b826ef, type: 3} - m_PrefabInstance: {fileID: 110786869} - m_PrefabAsset: {fileID: 0} ---- !u!114 &1221260112 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1221260105} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f9e99d5848b80d246b6540ad0aabf4d8, type: 3} - m_Name: - m_EditorClassIdentifier: Assembly-CSharp::Player - health: 100 --- !u!1 &1249073701 stripped GameObject: m_CorrespondingSourceObject: {fileID: -8098169881513260187, guid: fa9ce4c3e422d4dfb8c7546b16bc9f33, type: 3} diff --git a/Assets/Scripts/Game/Input/InputData.cs b/Assets/Scripts/Game/Input/InputData.cs index 7cc945c..5492156 100644 --- a/Assets/Scripts/Game/Input/InputData.cs +++ b/Assets/Scripts/Game/Input/InputData.cs @@ -20,43 +20,11 @@ public static class InputData public static MouseButton middleMouseButton; public static MouseButton rightMouseButton; - public static Button up; - public static Button down; - public static Button debugButton; - public static Button agentDebugButton; + public static Button fireWeapon; + public static Button reload; + public static Button jump; - public static Button rotateLeft; - public static Button rotateRight; - - public static Button cancel; - - public static Button floorUp; - public static Button floorDown; - - public static Button cameraLeft; - public static Button cameraRight; - public static Button cameraUp; - public static Button cameraDown; - public static Button cameraRotateLeft; - public static Button cameraRotateRight; - public static Button cameraSpeedBoost; - - public static Button pauseTime; - - public static Button pauseGame; - - public static Axis cameraHorizontal; - public static Axis cameraVertical; - -#if MARKETING_BUILD - - public static Axis fovAxis; - - public static Axis cameraUpDownAxis; - public static Axis marketingCameraX; - public static Axis marketingCameraY; - -#endif + public static Axis horizontalMovement; private static List