feat: player can jump with adjustable gravity

This commit is contained in:
2026-02-24 11:02:55 +01:00
parent fe7550d9e2
commit 667ff8acce
485 changed files with 213094 additions and 3219 deletions

View File

@@ -118,6 +118,15 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Jump"",
""type"": ""Button"",
""id"": ""57b8c346-a3cf-4ff7-b88e-40c941b1ee1f"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
@@ -340,6 +349,28 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
""action"": ""Fire"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""6980ad91-eccc-46ff-9c2c-839e46fad8d4"",
""path"": ""<Keyboard>/space"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""27e601ac-68ca-432e-bea3-d1d836f837a2"",
""path"": ""<Gamepad>/buttonSouth"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
},
@@ -928,6 +959,7 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
m_Player_Move = m_Player.FindAction("Move", throwIfNotFound: true);
m_Player_Look = m_Player.FindAction("Look", throwIfNotFound: true);
m_Player_Fire = m_Player.FindAction("Fire", throwIfNotFound: true);
m_Player_Jump = m_Player.FindAction("Jump", throwIfNotFound: true);
// UI
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
m_UI_Navigate = m_UI.FindAction("Navigate", throwIfNotFound: true);
@@ -1024,6 +1056,7 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
private readonly InputAction m_Player_Move;
private readonly InputAction m_Player_Look;
private readonly InputAction m_Player_Fire;
private readonly InputAction m_Player_Jump;
/// <summary>
/// Provides access to input actions defined in input action map "Player".
/// </summary>
@@ -1048,6 +1081,10 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
/// </summary>
public InputAction @Fire => m_Wrapper.m_Player_Fire;
/// <summary>
/// Provides access to the underlying input action "Player/Jump".
/// </summary>
public InputAction @Jump => m_Wrapper.m_Player_Jump;
/// <summary>
/// Provides access to the underlying input action map instance.
/// </summary>
public InputActionMap Get() { return m_Wrapper.m_Player; }
@@ -1082,6 +1119,9 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
@Fire.started += instance.OnFire;
@Fire.performed += instance.OnFire;
@Fire.canceled += instance.OnFire;
@Jump.started += instance.OnJump;
@Jump.performed += instance.OnJump;
@Jump.canceled += instance.OnJump;
}
/// <summary>
@@ -1102,6 +1142,9 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
@Fire.started -= instance.OnFire;
@Fire.performed -= instance.OnFire;
@Fire.canceled -= instance.OnFire;
@Jump.started -= instance.OnJump;
@Jump.performed -= instance.OnJump;
@Jump.canceled -= instance.OnJump;
}
/// <summary>
@@ -1423,6 +1466,13 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnFire(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Jump" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnJump(InputAction.CallbackContext context);
}
/// <summary>
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "UI" which allows adding and removing callbacks.

View File

@@ -32,6 +32,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Jump",
"type": "Button",
"id": "57b8c346-a3cf-4ff7-b88e-40c941b1ee1f",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
@@ -254,6 +263,28 @@
"action": "Fire",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "6980ad91-eccc-46ff-9c2c-839e46fad8d4",
"path": "<Keyboard>/space",
"interactions": "",
"processors": "",
"groups": "",
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "27e601ac-68ca-432e-bea3-d1d836f837a2",
"path": "<Gamepad>/buttonSouth",
"interactions": "",
"processors": "",
"groups": "",
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
}
]
},

View File

@@ -122,6 +122,37 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &79869126
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 79869127}
m_Layer: 0
m_Name: groundCheck
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &79869127
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 79869126}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -1.03, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1680796422}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &125070999
GameObject:
m_ObjectHideFlags: 0
@@ -241,12 +272,12 @@ GameObject:
- component: {fileID: 420667097}
- component: {fileID: 420667096}
- component: {fileID: 420667095}
m_Layer: 0
m_Layer: 6
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 2147483647
m_IsActive: 1
--- !u!65 &420667095
BoxCollider:
@@ -346,12 +377,12 @@ GameObject:
- component: {fileID: 463387415}
- component: {fileID: 463387414}
- component: {fileID: 463387413}
m_Layer: 0
m_Layer: 6
m_Name: Platform
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 2147483647
m_IsActive: 1
--- !u!65 &463387413
BoxCollider:
@@ -534,6 +565,429 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1168121045
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1168121046}
- component: {fileID: 1168121049}
- component: {fileID: 1168121048}
- component: {fileID: 1168121047}
m_Layer: 0
m_Name: stair (3)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1168121046
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1168121045}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.836, z: 1.784}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1351275945}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &1168121047
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1168121045}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1168121048
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1168121045}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 4e083d038de05807b8251393125f9200, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1168121049
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1168121045}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1174631443
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1174631444}
- component: {fileID: 1174631447}
- component: {fileID: 1174631446}
- component: {fileID: 1174631445}
m_Layer: 0
m_Name: stair (2)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1174631444
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1174631443}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.396, z: 1.247}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1351275945}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &1174631445
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1174631443}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1174631446
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1174631443}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 4e083d038de05807b8251393125f9200, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1174631447
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1174631443}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1351275941
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1351275945}
- component: {fileID: 1351275944}
- component: {fileID: 1351275943}
- component: {fileID: 1351275942}
m_Layer: 0
m_Name: stair
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1351275942
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1351275941}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1351275943
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1351275941}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 4e083d038de05807b8251393125f9200, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1351275944
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1351275941}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1351275945
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1351275941}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.8824787, y: 0.32, z: 11.41}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1501225938}
- {fileID: 1174631444}
- {fileID: 1168121046}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1501225937
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1501225938}
- component: {fileID: 1501225941}
- component: {fileID: 1501225940}
- component: {fileID: 1501225939}
m_Layer: 0
m_Name: stair (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1501225938
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1501225937}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.2, z: 0.72}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1351275945}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &1501225939
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1501225937}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1501225940
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1501225937}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 4e083d038de05807b8251393125f9200, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1501225941
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1501225937}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1680796418
GameObject:
m_ObjectHideFlags: 0
@@ -638,11 +1092,12 @@ Transform:
m_GameObject: {fileID: 1680796418}
serializedVersion: 2
m_LocalRotation: {x: 0, y: -0.80701184, z: 0, w: 0.59053534}
m_LocalPosition: {x: 0, y: 2.23, z: 0}
m_LocalPosition: {x: 0, y: 9.59, z: 0}
m_LocalScale: {x: 1.2, y: 1.8, z: 1.2}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 125071002}
- {fileID: 79869127}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: -107.61, z: 0}
--- !u!114 &1680796423
@@ -734,6 +1189,22 @@ MonoBehaviour:
m_Calls: []
m_ActionId: 6e0ae25a-6a8d-496d-976f-5b53f4787f9a
m_ActionName: UI/TrackedDeviceOrientation
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1680796424}
m_TargetAssemblyTypeName: PlayerMovement, Assembly-CSharp
m_MethodName: Jump
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_ActionId: 57b8c346-a3cf-4ff7-b88e-40c941b1ee1f
m_ActionName: Player/Jump[/Keyboard/space]
m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme:
m_DefaultActionMap: Player
@@ -753,6 +1224,10 @@ MonoBehaviour:
m_EditorClassIdentifier:
controller: {fileID: 1680796425}
speed: 10
groundCheck: {fileID: 79869127}
groundMask:
serializedVersion: 2
m_Bits: 64
--- !u!143 &1680796425
CharacterController:
m_ObjectHideFlags: 0
@@ -772,7 +1247,7 @@ CharacterController:
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Height: 3.8
m_Height: 2.2
m_Radius: 0.6
m_SlopeLimit: 45
m_StepOffset: 0.3
@@ -786,3 +1261,4 @@ SceneRoots:
- {fileID: 574677459}
- {fileID: 463387416}
- {fileID: 1680796422}
- {fileID: 1351275945}

View File

@@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
using UnityEngine.InputSystem;
@@ -8,20 +7,55 @@ public class PlayerMovement : MonoBehaviour
private InputMaster _inputMaster;
[SerializeField] private CharacterController controller;
[SerializeField] private float speed;
[SerializeField] private Transform groundCheck;
private float _groundDistance = 0.4f;
[SerializeField] private LayerMask groundMask;
private Vector2 _moveDirection;
private Vector3 _velocity;
private readonly float _gravity = -9.81f * 2f;
private bool _isGrounded;
private float _jumpHeight = 3f;
private void Awake()
{
controller = GetComponent<CharacterController>();
_inputMaster = new InputMaster();
_inputMaster.Player.Move.Enable();
_inputMaster.Player.Jump.Enable();
}
public void OnMove(InputAction.CallbackContext context)
{
_moveDirection = context.ReadValue<Vector2>();
Debug.Log("direction: " + _moveDirection);
private void Update()
{
_isGrounded = Physics.CheckSphere(groundCheck.position, _groundDistance, groundMask);
if (_isGrounded && _velocity.y < 0)
{
_velocity.y = -2f; //force player on the ground
}
_moveDirection = _inputMaster.Player.Move.ReadValue<Vector2>();
Vector3 move = transform.right * _moveDirection.x + transform.forward * _moveDirection.y;
controller.Move(move * (speed * Time.deltaTime));
_velocity.y += _gravity * Time.deltaTime;
controller.Move(_velocity * Time.deltaTime); // multiply again because of m/s^2
}
public void Jump(InputAction.CallbackContext context)
{
if (context.performed)
{
if (_isGrounded)
{
_velocity.y = (float)Math.Sqrt(_jumpHeight * -2f * _gravity);
}
}
}
private void OnDisable()
{
_inputMaster.Player.Move.Disable();
_inputMaster.Player.Jump.Disable();
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
{
"process_id" : 156074,
"process_id" : 182338,
"version" : "2022.3.62f3",
"app_path" : "/home/tom/Unity/Hub/Editor/2022.3.62f3/Editor/Unity",
"app_contents_path" : "/home/tom/Unity/Hub/Editor/2022.3.62f3/Editor/Data"

Binary file not shown.

View File

@@ -1 +1 @@
[{"Port":38195,"SolutionName":"OMG","ProtocolGuid":"ca1ba338-cca4-4e4d-8a49-b08f8e521651"}]
[{"Port":39841,"SolutionName":"OMG","ProtocolGuid":"ca1ba338-cca4-4e4d-8a49-b08f8e521651"}]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1 +1 @@
{"m_ScrollY":0.0,"m_ExpandedSceneGameObjectInstanceIDs":[-1238,24416],"m_LastClickedInstanceID":24380,"m_OpenSceneGUIDs":["489151ee02f65d1a2b21a93f3b4c16a1"]}
{"m_ScrollY":0.0,"m_ExpandedSceneGameObjectInstanceIDs":[-1238,24456],"m_LastClickedInstanceID":24456,"m_OpenSceneGUIDs":["489151ee02f65d1a2b21a93f3b4c16a1"]}

View File

@@ -1 +1 @@
{"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":true,"audioPlay":false,"sceneViewState":{"m_AlwaysRefresh":false,"showFog":true,"showSkybox":true,"showFlares":true,"showImageEffects":true,"showParticleSystems":true,"showVisualEffectGraphs":true,"m_FxEnabled":true},"in2DMode":false,"pivot":{"x":-0.8824787139892578,"y":1.7172164916992188,"z":1.454451084136963},"rotation":{"x":-0.12305651605129242,"y":0.8049057722091675,"z":-0.1794092059135437,"w":-0.5520837306976318},"size":15.732234001159668,"orthographic":false}
{"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":true,"audioPlay":false,"sceneViewState":{"m_AlwaysRefresh":false,"showFog":true,"showSkybox":true,"showFlares":true,"showImageEffects":true,"showParticleSystems":true,"showVisualEffectGraphs":true,"m_FxEnabled":true},"in2DMode":false,"pivot":{"x":0.0,"y":7.736000061035156,"z":0.0},"rotation":{"x":-0.045946359634399417,"y":0.7032898664474487,"z":-0.045643795281648639,"w":-0.7079483866691589},"size":10.0,"orthographic":false}

View File

@@ -20,5 +20,5 @@ MonoBehaviour:
m_Values:
- '{"m_FixedPaneDimension":150.0}'
- '{"m_FixedPaneDimension":391.5}'
- '{"m_ShowAlternatingRowBackgrounds":0,"serializedVirtualizationData":{"scrollOffset":{"x":0.0,"y":0.0},"firstVisibleIndex":0,"contentPadding":0.0,"contentHeight":0.0,"anchoredItemIndex":0,"anchorOffset":0.0},"m_ExpandedItemIds":[718848679,962104716,2050439047]}'
- '{"m_ShowAlternatingRowBackgrounds":0,"serializedVirtualizationData":{"scrollOffset":{"x":0.0,"y":0.0},"firstVisibleIndex":0,"contentPadding":0.0,"contentHeight":0.0,"anchoredItemIndex":0,"anchorOffset":0.0},"m_ExpandedItemIds":[718848679,962104716,-1365245703,-824090768]}'
- '{"m_Value":0.0,"m_LowValue":0.0,"m_HighValue":0.0}'

View File

@@ -1 +1 @@
156215
182481

View File

@@ -142,8 +142,7 @@ PlayerSettings:
visionOSBundleVersion: 1.0
tvOSBundleVersion: 1.0
bundleVersion: 0.1
preloadedAssets:
- {fileID: 11400000, guid: 6975b0e202dc0fdc8851db3e06eb73e3, type: 2}
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1

View File

@@ -11,7 +11,7 @@ TagManager:
-
- Water
- UI
-
- Ground
-
-
-

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More