Updated PlayerController.cs

This commit is contained in:
OverflowNarhoym 2022-02-21 21:36:08 +01:00
parent aebb1f0f05
commit db47afe89d
3 changed files with 365 additions and 211 deletions

View File

@ -123,7 +123,7 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &46615294
--- !u!1 &65152409
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -131,43 +131,75 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 46615295}
- component: {fileID: 46615296}
- component: {fileID: 65152410}
- component: {fileID: 65152411}
m_Layer: 0
m_Name: CollisionChecker
m_Name: CM vcam1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &46615295
--- !u!4 &65152410
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 46615294}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.005, y: -0.483, z: 0}
m_LocalScale: {x: 0.98, y: 0.05, z: 1}
m_GameObject: {fileID: 65152409}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 1.9862347, y: 2.4004586, z: -9.967962}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1053905692}
m_RootOrder: 0
m_Children:
- {fileID: 1483260705}
m_Father: {fileID: 1448490237}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &46615296
--- !u!114 &65152411
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 46615294}
m_GameObject: {fileID: 65152409}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7, type: 3}
m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1053905690
m_ExcludedPropertiesInInspector:
- m_Script
m_LockStageInInspector:
m_StreamingVersion: 20170927
m_Priority: 10
m_StandbyUpdate: 2
m_LookAt: {fileID: 0}
m_Follow: {fileID: 1053905692}
m_Lens:
FieldOfView: 60
OrthographicSize: 5
NearClipPlane: 0.3
FarClipPlane: 1000
Dutch: 0
ModeOverride: 0
LensShift: {x: 0, y: 0}
GateFit: 2
m_SensorSize: {x: 1.7777778, y: 1}
m_Transitions:
m_BlendHint: 0
m_InheritPosition: 0
m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1483260705}
--- !u!4 &1053905692 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
m_PrefabInstance: {fileID: 7008207193554258683}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1448490236
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -175,83 +207,119 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1053905692}
- component: {fileID: 1053905691}
- component: {fileID: 1448490237}
m_Layer: 0
m_Name: Player
m_Name: Camera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &1053905691
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1053905690}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
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: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1053905692
--- !u!4 &1448490237
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1053905690}
m_GameObject: {fileID: 1448490236}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.9018374, y: 0.6227216, z: 0}
m_LocalPosition: {x: -6.536235, y: -1.9904585, z: -0.03203782}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 46615295}
- {fileID: 1514474963}
- {fileID: 65152410}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1483260704
GameObject:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1483260705}
- component: {fileID: 1483260707}
- component: {fileID: 1483260706}
m_Layer: 0
m_Name: cm
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1483260705
Transform:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1483260704}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 6.536235, y: 1.9904585, z: 7.6195736}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 65152410}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1483260706
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1483260704}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6ad980451443d70438faac0bc6c235a0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_TrackedObjectOffset: {x: 0, y: 0, z: 0}
m_LookaheadTime: 0
m_LookaheadSmoothing: 0
m_LookaheadIgnoreY: 0
m_XDamping: 1
m_YDamping: 1
m_ZDamping: 1
m_TargetMovementOnly: 1
m_ScreenX: 0.5
m_ScreenY: 0.5
m_CameraDistance: 10
m_DeadZoneWidth: 0
m_DeadZoneHeight: 0
m_DeadZoneDepth: 0
m_UnlimitedSoftZone: 0
m_SoftZoneWidth: 0.8
m_SoftZoneHeight: 0.8
m_BiasX: 0
m_BiasY: 0
m_CenterOnActivate: 1
m_GroupFramingMode: 2
m_AdjustmentMode: 0
m_GroupFramingSize: 0.8
m_MaxDollyIn: 5000
m_MaxDollyOut: 5000
m_MinimumDistance: 1
m_MaximumDistance: 5000
m_MinimumFOV: 3
m_MaximumFOV: 60
m_MinimumOrthoSize: 1
m_MaximumOrthoSize: 5000
--- !u!114 &1483260707
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1483260704}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1514474960
GameObject:
m_ObjectHideFlags: 0
@ -263,6 +331,7 @@ GameObject:
- component: {fileID: 1514474963}
- component: {fileID: 1514474962}
- component: {fileID: 1514474961}
- component: {fileID: 1514474964}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@ -288,7 +357,7 @@ Camera:
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_BackGroundColor: {r: 0.8867924, g: 0.14556777, b: 0.5208201, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
@ -328,14 +397,48 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1514474960}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 1.9862347, y: 2.4004586, z: -9.967962}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_Father: {fileID: 1448490237}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1514474964
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1514474960}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ShowDebugText: 0
m_ShowCameraFrustum: 1
m_IgnoreTimeScale: 0
m_WorldUpOverride: {fileID: 0}
m_UpdateMethod: 2
m_BlendUpdateMethod: 1
m_DefaultBlend:
m_Style: 1
m_Time: 2
m_CustomCurve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_CustomBlends: {fileID: 0}
m_CameraCutEvent:
m_PersistentCalls:
m_Calls: []
m_CameraActivatedEvent:
m_PersistentCalls:
m_Calls: []
--- !u!1 &1524344315
GameObject:
m_ObjectHideFlags: 0
@ -428,89 +531,127 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1816931259
GameObject:
--- !u!1001 &847968261128498245
PrefabInstance:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1816931261}
- component: {fileID: 1816931260}
m_Layer: 3
m_Name: Square
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &1816931260
SpriteRenderer:
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalScale.x
value: 20
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.x
value: -3.79
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.y
value: -0.89
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012094, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_Name
value: PlatformTest
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
--- !u!1001 &7008207193554258683
PrefabInstance:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1816931259}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
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: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1816931261
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1816931259}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.79, y: -0.89, z: 0}
m_LocalScale: {x: 6.1417, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 7008207192594766305, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_Name
value: Player
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766309, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_Interpolate
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalPosition.x
value: -4.55
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalPosition.y
value: 0.41
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}

View File

@ -7,21 +7,35 @@ namespace Player
{
public class PlayerController : MonoBehaviour, IMovement, Input.PlayerInput.IPlayerControlActions
{
private const float DefaultJumpForce = 1200.0f;
private const float DefaultMass = 80.0f;
private const float DefaultSpeed = 500.0f;
private const float GravityScale = 3.0f;
private Input.PlayerInput _controls;
private Rigidbody2D _playerRigidbody2D;
private SpriteRenderer _playerSpriteRenderer;
private CollisionChecker _playerGroundTrigger;
private bool _moveKeyPressed;
private bool _jumpKeyPressed;
private bool _canJump = true;
private bool _isOnAir;
private float _xAxisValue;
private void Awake()
{
this._playerRigidbody2D = GameObject.Find("Player").GetComponent<Rigidbody2D>();
this._playerRigidbody2D = gameObject.GetComponent<Rigidbody2D>();
this._playerGroundTrigger = GameObject.Find("PlayerGroundTrigger").GetComponent<CollisionChecker>();
this._playerSpriteRenderer = gameObject.GetComponent<SpriteRenderer>();
}
private void Start()
{
this._playerRigidbody2D.gravityScale = GravityScale;
this._playerRigidbody2D.mass = DefaultMass;
BaseSpeed = DefaultSpeed;
}
private void OnEnable()
@ -47,22 +61,22 @@ namespace Player
else
_playerRigidbody2D.velocity = new Vector2(0.0f, _playerRigidbody2D.velocity.y);
if (_jumpKeyPressed)
if (_jumpKeyPressed && _playerGroundTrigger.IsCollided)
Jump();
}
// PAUSE METHODS
public bool IsPaused { get; }
public bool IsPaused { get; private set; }
public void Pause()
{
throw new NotImplementedException();
IsPaused = true;
}
public void Resume()
{
throw new NotImplementedException();
IsPaused = false;
}
// MOVE METHODS
@ -87,7 +101,8 @@ namespace Player
private void Jump()
{
throw new NotImplementedException();
_playerRigidbody2D.velocity = new Vector2(_playerRigidbody2D.velocity.x, 0);
_playerRigidbody2D.AddForce(Vector2.up.normalized * DefaultJumpForce, ForceMode2D.Impulse);
}
private void Climb()
@ -117,7 +132,6 @@ namespace Player
{
case true:
_jumpKeyPressed = false;
_canJump = true;
break;
case false:
_jumpKeyPressed = true;

View File

@ -25,7 +25,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192}
vertical: 0
controlID: 85
controlID: 10853
--- !u!114 &2
MonoBehaviour:
m_ObjectHideFlags: 52
@ -46,9 +46,9 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 296.80002
y: 73.6
width: 918.8
x: 1
y: 19
width: 878
height: 493.40002
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
@ -85,9 +85,9 @@ MonoBehaviour:
m_VAllowExceedBaseRangeMax: 1
m_ScaleWithWindow: 0
m_HSlider: 0
m_VSlider: 1
m_VSlider: 0
m_IgnoreScrollWheelUntilClicked: 0
m_EnableMouseInput: 1
m_EnableMouseInput: 0
m_EnableSliderZoomHorizontal: 0
m_EnableSliderZoomVertical: 0
m_UniformScale: 1
@ -96,23 +96,23 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 21
width: 918.8
width: 878
height: 472.40002
m_Scale: {x: 0.5467593, y: 0.5467593}
m_Translation: {x: 459.4, y: 236.19998}
m_Translation: {x: 439, y: 236.19998}
m_MarginLeft: 0
m_MarginRight: 0
m_MarginTop: 0
m_MarginBottom: 0
m_LastShownAreaInsideMargins:
serializedVersion: 2
x: -840.22345
x: -802.9127
y: -431.99994
width: 1680.4469
width: 1605.8254
height: 863.99994
m_MinimalGUI: 1
m_defaultScale: 0.5467593
m_LastWindowPixelSize: {x: 1148.5, y: 616.75}
m_LastWindowPixelSize: {x: 1097.5, y: 616.75}
m_ClearInEditMode: 1
m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 00000000000100000100
@ -142,7 +142,7 @@ MonoBehaviour:
m_MinSize: {x: 100, y: 200}
m_MaxSize: {x: 8096, y: 16192}
vertical: 1
controlID: 47
controlID: 10791
--- !u!114 &4
MonoBehaviour:
m_ObjectHideFlags: 52
@ -162,8 +162,8 @@ MonoBehaviour:
y: 0
width: 304
height: 381.6
m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021}
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 5}
m_Panes:
- {fileID: 5}
@ -202,7 +202,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 16f8ffff0cfbffff
m_ExpandedIDs: c0b0ffff8af0ffff0efbffff
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -292,8 +292,7 @@ MonoBehaviour:
m_ShowAllHits: 0
m_SkipHidden: 0
m_SearchArea: 1
m_Folders:
- Assets/Scenes
m_Folders: []
m_Globs: []
m_OriginalText:
m_ViewMode: 0
@ -307,7 +306,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: dc3c0000
m_LastClickedID: 15580
m_ExpandedIDs: 00000000f2620000f4620000f6620000
m_ExpandedIDs: ffffffff00000000f2620000f4620000f6620000ae6300001464000016640000b27d00002483000050830000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -333,9 +332,9 @@ MonoBehaviour:
m_ResourceFile:
m_AssetTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 12640000
m_LastClickedID: 25618
m_ExpandedIDs: ffffffff00000000f2620000f4620000f6620000ac630000ae630000
m_SelectedIDs: 987d0000
m_LastClickedID: 0
m_ExpandedIDs: ffffffff00000000f2620000f4620000f6620000ae6300001464000016640000b27d00002483000050830000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -351,7 +350,7 @@ MonoBehaviour:
m_IsRenaming: 0
m_OriginalEventType: 11
m_IsRenamingFilename: 1
m_ClientGUIView: {fileID: 6}
m_ClientGUIView: {fileID: 0}
m_SearchString:
m_CreateAssetUtility:
m_EndAction: {fileID: 0}
@ -360,8 +359,8 @@ MonoBehaviour:
m_Icon: {fileID: 0}
m_ResourceFile:
m_ListAreaState:
m_SelectedInstanceIDs: 12640000
m_LastClickedInstanceID: 25618
m_SelectedInstanceIDs: 987d0000
m_LastClickedInstanceID: 32152
m_HadKeyboardFocusLastEvent: 0
m_ExpandedInstanceIDs: c6230000d03c0000
m_RenameOverlay:
@ -410,12 +409,12 @@ MonoBehaviour:
serializedVersion: 2
x: 304
y: 0
width: 879.19995
width: 880
height: 730.8
m_MinSize: {x: 100, y: 200}
m_MaxSize: {x: 8096, y: 16192}
vertical: 1
controlID: 86
controlID: 10854
--- !u!114 &9
MonoBehaviour:
m_ObjectHideFlags: 52
@ -433,7 +432,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 879.19995
width: 880
height: 514.4
m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021}
@ -465,7 +464,7 @@ MonoBehaviour:
serializedVersion: 2
x: 304
y: 73.6
width: 877.19995
width: 878
height: 493.40002
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
@ -574,7 +573,7 @@ MonoBehaviour:
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
displayed: 1
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
@ -690,9 +689,9 @@ MonoBehaviour:
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: -0.15326892, y: 0.05985144, z: -0.113706104}
m_Target: {x: -7.976013, y: -1.8524797, z: -0.06713244}
speed: 2
m_Value: {x: -0.15326892, y: 0.05985144, z: -0.113706104}
m_Value: {x: -7.976013, y: -1.8524797, z: -0.06713244}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
@ -743,9 +742,9 @@ MonoBehaviour:
speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size:
m_Target: 6.153973
m_Target: 7.3032284
speed: 2
m_Value: 6.153973
m_Value: 7.3032284
m_Ortho:
m_Target: 1
speed: 2
@ -787,7 +786,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 514.4
width: 879.19995
width: 880
height: 216.39996
m_MinSize: {x: 102, y: 121}
m_MaxSize: {x: 4002, y: 4021}
@ -818,7 +817,7 @@ MonoBehaviour:
serializedVersion: 2
x: 304
y: 588
width: 877.19995
width: 878
height: 195.39996
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
@ -839,9 +838,9 @@ MonoBehaviour:
m_Children: []
m_Position:
serializedVersion: 2
x: 1183.2
x: 1184
y: 0
width: 352.80005
width: 352
height: 730.8
m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4001, y: 4021}
@ -870,9 +869,9 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 1183.2001
x: 1184
y: 73.6
width: 351.80005
width: 351
height: 709.8
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
@ -884,8 +883,8 @@ MonoBehaviour:
m_CachedPref: 160
m_ControlHash: -371814159
m_PrefName: Preview_InspectorPreview
m_LastInspectedObjectInstanceID: 25618
m_LastVerticalScrollValue: 0
m_LastInspectedObjectInstanceID: 32152
m_LastVerticalScrollValue: 160.79999
m_GlobalObjectId:
m_InspectorMode: 0
m_LockTracker: