diff --git a/.idea/.idea.RunAndGun/.idea/.gitignore b/.idea/.idea.RunAndGun/.idea/.gitignore
new file mode 100644
index 0000000..8f6897b
--- /dev/null
+++ b/.idea/.idea.RunAndGun/.idea/.gitignore
@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/modules.xml
+/contentModel.xml
+/projectSettingsUpdater.xml
+/.idea.RunAndGun.iml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/.idea.RunAndGun/.idea/indexLayout.xml b/.idea/.idea.RunAndGun/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/.idea/.idea.RunAndGun/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.RunAndGun/.idea/vcs.xml b/.idea/.idea.RunAndGun/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/.idea.RunAndGun/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Assets/Materials.meta b/Assets/Materials.meta
new file mode 100644
index 0000000..8894567
--- /dev/null
+++ b/Assets/Materials.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 61473f187dee7694888a62a9aac12f1b
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Materials/NoFriction.physicsMaterial2D b/Assets/Materials/NoFriction.physicsMaterial2D
new file mode 100644
index 0000000..ed02e65
--- /dev/null
+++ b/Assets/Materials/NoFriction.physicsMaterial2D
@@ -0,0 +1,11 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!62 &6200000
+PhysicsMaterial2D:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_Name: NoFriction
+ friction: 0
+ bounciness: 0
diff --git a/Assets/Materials/NoFriction.physicsMaterial2D.meta b/Assets/Materials/NoFriction.physicsMaterial2D.meta
new file mode 100644
index 0000000..1768daa
--- /dev/null
+++ b/Assets/Materials/NoFriction.physicsMaterial2D.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b703f35e8d8996a4794fdd66fffd0dc9
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 6200000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity
index 7b420f6..d5f5c10 100644
--- a/Assets/Scenes/SampleScene.unity
+++ b/Assets/Scenes/SampleScene.unity
@@ -104,7 +104,7 @@ NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
- serializedVersion: 2
+ serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
@@ -117,7 +117,7 @@ NavMeshSettings:
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
- accuratePlacement: 0
+ buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
@@ -172,6 +172,7 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
+ m_VolumeFrameworkUpdateModeOption: 2
m_RenderPostProcessing: 0
m_Antialiasing: 0
m_AntialiasingQuality: 2
@@ -179,9 +180,20 @@ MonoBehaviour:
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_Version: 2
+ m_TaaSettings:
+ quality: 3
+ frameInfluence: 0.1
+ jitterScale: 1
+ mipBias: 0
+ varianceClampScale: 0.9
+ contrastAdaptiveSharpening: 0
--- !u!20 &519420031
Camera:
m_ObjectHideFlags: 0
@@ -192,13 +204,21 @@ Camera:
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
- m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
+ m_BackGroundColor: {r: 0.3018868, g: 0.044143822, b: 0.15419665, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
+ m_Iso: 200
+ m_ShutterSpeed: 0.005
+ m_Aperture: 16
+ m_FocusDistance: 10
+ m_FocalLength: 50
+ m_BladeCount: 5
+ m_Curvature: {x: 2, y: 11}
+ m_BarrelClipping: 0.25
+ m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
- m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
@@ -232,13 +252,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519420028}
+ serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
- m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &619394800
GameObject:
@@ -281,6 +301,7 @@ MonoBehaviour:
m_LightCookieSprite: {fileID: 0}
m_DeprecatedPointLightCookieSprite: {fileID: 0}
m_LightOrder: 0
+ m_AlphaBlendOnOverlap: 0
m_OverlapOperation: 0
m_NormalMapDistance: 3
m_NormalMapQuality: 2
@@ -289,35 +310,6 @@ MonoBehaviour:
m_ShadowIntensity: 0.75
m_ShadowVolumeIntensityEnabled: 0
m_ShadowVolumeIntensity: 0.75
- m_Vertices:
- - position: {x: 0.9985302, y: 0.9985302, z: 0}
- color: {r: 0.70710677, g: 0.70710677, b: 0, a: 0}
- uv: {x: 0, y: 0}
- - position: {x: 0.9985302, y: 0.9985302, z: 0}
- color: {r: 0, g: 0, b: 0, a: 1}
- uv: {x: 0, y: 0}
- - position: {x: -0.9985302, y: 0.9985302, z: 0}
- color: {r: -0.70710677, g: 0.70710677, b: 0, a: 0}
- uv: {x: 0, y: 0}
- - position: {x: -0.9985302, y: 0.9985302, z: 0}
- color: {r: 0, g: 0, b: 0, a: 1}
- uv: {x: 0, y: 0}
- - position: {x: -0.99853003, y: -0.9985304, z: 0}
- color: {r: -0.70710665, g: -0.7071069, b: 0, a: 0}
- uv: {x: 0, y: 0}
- - position: {x: -0.99853003, y: -0.9985304, z: 0}
- color: {r: 0, g: 0, b: 0, a: 1}
- uv: {x: 0, y: 0}
- - position: {x: 0.99853003, y: -0.9985304, z: 0}
- color: {r: 0.70710665, g: -0.7071069, b: 0, a: 0}
- uv: {x: 0, y: 0}
- - position: {x: 0.99853003, y: -0.9985304, z: 0}
- color: {r: 0, g: 0, b: 0, a: 1}
- uv: {x: 0, y: 0}
- - position: {x: 0, y: 0, z: 0}
- color: {r: 0, g: 0, b: 0, a: 1}
- uv: {x: 0, y: 0}
- m_Triangles: 030001000800020000000100030002000100050003000800040002000300050004000300070005000800060004000500070006000500010007000800000006000700010000000700
m_LocalBounds:
m_Center: {x: 0, y: -0.00000011920929, z: 0}
m_Extent: {x: 0.9985302, y: 0.99853027, z: 0}
@@ -342,11 +334,189 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 619394800}
+ serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
- m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &1094939059
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1094939063}
+ - component: {fileID: 1094939062}
+ - component: {fileID: 1094939061}
+ - component: {fileID: 1094939060}
+ m_Layer: 0
+ m_Name: PlayerMain
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!50 &1094939060
+Rigidbody2D:
+ serializedVersion: 4
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1094939059}
+ m_BodyType: 0
+ m_Simulated: 1
+ m_UseFullKinematicContacts: 0
+ m_UseAutoMass: 0
+ m_Mass: 1
+ m_LinearDrag: 0
+ m_AngularDrag: 0.05
+ m_GravityScale: 0
+ m_Material: {fileID: 0}
+ m_IncludeLayers:
+ serializedVersion: 2
+ m_Bits: 0
+ m_ExcludeLayers:
+ serializedVersion: 2
+ m_Bits: 0
+ m_Interpolate: 1
+ m_SleepingMode: 0
+ m_CollisionDetection: 1
+ m_Constraints: 4
+--- !u!114 &1094939061
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1094939059}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: d673274af6c36104abfc3cb26d0d9d80, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ speed: 4
+--- !u!114 &1094939062
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1094939059}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: d0acec35a78e29146a034edf59dec9f4, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+--- !u!4 &1094939063
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1094939059}
+ serializedVersion: 2
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children:
+ - {fileID: 1505234463}
+ m_Father: {fileID: 0}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &1505234462
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1505234463}
+ - component: {fileID: 1505234464}
+ m_Layer: 0
+ m_Name: Visual
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1505234463
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1505234462}
+ serializedVersion: 2
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.75, z: 0}
+ m_LocalScale: {x: 1, y: 1.5, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 1094939063}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!212 &1505234464
+SpriteRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1505234462}
+ 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: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 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: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
+ m_Color: {r: 0, g: 0.88305783, b: 1, a: 1}
+ m_FlipX: 0
+ m_FlipY: 0
+ m_DrawMode: 0
+ m_Size: {x: 1, y: 2}
+ m_AdaptiveModeThreshold: 0.5
+ m_SpriteTileMode: 0
+ m_WasSpriteAssigned: 1
+ m_MaskInteraction: 0
+ m_SpriteSortPoint: 0
+--- !u!1660057539 &9223372036854775807
+SceneRoots:
+ m_ObjectHideFlags: 0
+ m_Roots:
+ - {fileID: 519420032}
+ - {fileID: 619394802}
+ - {fileID: 1094939063}
diff --git a/Assets/Scripts.meta b/Assets/Scripts.meta
new file mode 100644
index 0000000..dda3dc1
--- /dev/null
+++ b/Assets/Scripts.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: aa75d1569eedf31408815c5385185c74
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/GameInputs.cs b/Assets/Scripts/GameInputs.cs
new file mode 100644
index 0000000..9d884a2
--- /dev/null
+++ b/Assets/Scripts/GameInputs.cs
@@ -0,0 +1,241 @@
+//------------------------------------------------------------------------------
+//
+// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
+// version 1.7.0
+// from Assets/Scripts/GameInputs.inputactions
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine.InputSystem;
+using UnityEngine.InputSystem.Utilities;
+
+public partial class @GameInputs: IInputActionCollection2, IDisposable
+{
+ public InputActionAsset asset { get; }
+ public @GameInputs()
+ {
+ asset = InputActionAsset.FromJson(@"{
+ ""name"": ""GameInputs"",
+ ""maps"": [
+ {
+ ""name"": ""Player"",
+ ""id"": ""eb96a956-b7ad-47fd-82f5-b4814e98e6b1"",
+ ""actions"": [
+ {
+ ""name"": ""Movement"",
+ ""type"": ""Value"",
+ ""id"": ""39923aa3-9a9e-4368-8ceb-bebf8ec65530"",
+ ""expectedControlType"": ""Vector2"",
+ ""processors"": """",
+ ""interactions"": """",
+ ""initialStateCheck"": true
+ },
+ {
+ ""name"": ""Jump"",
+ ""type"": ""Button"",
+ ""id"": ""436a199c-9091-4d2b-a0e8-afd8675d45f0"",
+ ""expectedControlType"": ""Button"",
+ ""processors"": """",
+ ""interactions"": """",
+ ""initialStateCheck"": false
+ }
+ ],
+ ""bindings"": [
+ {
+ ""name"": ""WASD"",
+ ""id"": ""0abdf8dd-305d-410a-9788-0a0b22384fd7"",
+ ""path"": ""2DVector(mode=1)"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""Movement"",
+ ""isComposite"": true,
+ ""isPartOfComposite"": false
+ },
+ {
+ ""name"": ""up"",
+ ""id"": ""4a50dfb9-46c0-4d52-ba54-1f4886fb77b8"",
+ ""path"": ""/w"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""Movement"",
+ ""isComposite"": false,
+ ""isPartOfComposite"": true
+ },
+ {
+ ""name"": ""down"",
+ ""id"": ""a50e92c0-3106-47f9-9499-ff34ca987d4c"",
+ ""path"": ""/s"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""Movement"",
+ ""isComposite"": false,
+ ""isPartOfComposite"": true
+ },
+ {
+ ""name"": ""left"",
+ ""id"": ""89e61e01-d935-4391-a515-c7f7aac8a744"",
+ ""path"": ""/a"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""Movement"",
+ ""isComposite"": false,
+ ""isPartOfComposite"": true
+ },
+ {
+ ""name"": ""right"",
+ ""id"": ""3a6ca3be-d76f-4ab1-ae0f-0193d87f36c0"",
+ ""path"": ""/d"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""Movement"",
+ ""isComposite"": false,
+ ""isPartOfComposite"": true
+ },
+ {
+ ""name"": """",
+ ""id"": ""f79d7b08-89bf-4b67-bba8-5ccaaea5501d"",
+ ""path"": ""/space"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""Jump"",
+ ""isComposite"": false,
+ ""isPartOfComposite"": false
+ }
+ ]
+ }
+ ],
+ ""controlSchemes"": []
+}");
+ // Player
+ m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
+ m_Player_Movement = m_Player.FindAction("Movement", throwIfNotFound: true);
+ m_Player_Jump = m_Player.FindAction("Jump", throwIfNotFound: true);
+ }
+
+ public void Dispose()
+ {
+ UnityEngine.Object.Destroy(asset);
+ }
+
+ public InputBinding? bindingMask
+ {
+ get => asset.bindingMask;
+ set => asset.bindingMask = value;
+ }
+
+ public ReadOnlyArray? devices
+ {
+ get => asset.devices;
+ set => asset.devices = value;
+ }
+
+ public ReadOnlyArray controlSchemes => asset.controlSchemes;
+
+ public bool Contains(InputAction action)
+ {
+ return asset.Contains(action);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return asset.GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ public void Enable()
+ {
+ asset.Enable();
+ }
+
+ public void Disable()
+ {
+ asset.Disable();
+ }
+
+ public IEnumerable bindings => asset.bindings;
+
+ public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
+ {
+ return asset.FindAction(actionNameOrId, throwIfNotFound);
+ }
+
+ public int FindBinding(InputBinding bindingMask, out InputAction action)
+ {
+ return asset.FindBinding(bindingMask, out action);
+ }
+
+ // Player
+ private readonly InputActionMap m_Player;
+ private List m_PlayerActionsCallbackInterfaces = new List();
+ private readonly InputAction m_Player_Movement;
+ private readonly InputAction m_Player_Jump;
+ public struct PlayerActions
+ {
+ private @GameInputs m_Wrapper;
+ public PlayerActions(@GameInputs wrapper) { m_Wrapper = wrapper; }
+ public InputAction @Movement => m_Wrapper.m_Player_Movement;
+ public InputAction @Jump => m_Wrapper.m_Player_Jump;
+ public InputActionMap Get() { return m_Wrapper.m_Player; }
+ public void Enable() { Get().Enable(); }
+ public void Disable() { Get().Disable(); }
+ public bool enabled => Get().enabled;
+ public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); }
+ public void AddCallbacks(IPlayerActions instance)
+ {
+ if (instance == null || m_Wrapper.m_PlayerActionsCallbackInterfaces.Contains(instance)) return;
+ m_Wrapper.m_PlayerActionsCallbackInterfaces.Add(instance);
+ @Movement.started += instance.OnMovement;
+ @Movement.performed += instance.OnMovement;
+ @Movement.canceled += instance.OnMovement;
+ @Jump.started += instance.OnJump;
+ @Jump.performed += instance.OnJump;
+ @Jump.canceled += instance.OnJump;
+ }
+
+ private void UnregisterCallbacks(IPlayerActions instance)
+ {
+ @Movement.started -= instance.OnMovement;
+ @Movement.performed -= instance.OnMovement;
+ @Movement.canceled -= instance.OnMovement;
+ @Jump.started -= instance.OnJump;
+ @Jump.performed -= instance.OnJump;
+ @Jump.canceled -= instance.OnJump;
+ }
+
+ public void RemoveCallbacks(IPlayerActions instance)
+ {
+ if (m_Wrapper.m_PlayerActionsCallbackInterfaces.Remove(instance))
+ UnregisterCallbacks(instance);
+ }
+
+ public void SetCallbacks(IPlayerActions instance)
+ {
+ foreach (var item in m_Wrapper.m_PlayerActionsCallbackInterfaces)
+ UnregisterCallbacks(item);
+ m_Wrapper.m_PlayerActionsCallbackInterfaces.Clear();
+ AddCallbacks(instance);
+ }
+ }
+ public PlayerActions @Player => new PlayerActions(this);
+ public interface IPlayerActions
+ {
+ void OnMovement(InputAction.CallbackContext context);
+ void OnJump(InputAction.CallbackContext context);
+ }
+}
diff --git a/Assets/Scripts/GameInputs.cs.meta b/Assets/Scripts/GameInputs.cs.meta
new file mode 100644
index 0000000..9b82769
--- /dev/null
+++ b/Assets/Scripts/GameInputs.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ec2845c73eee91a438f51abec0fc0a86
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/GameInputs.inputactions b/Assets/Scripts/GameInputs.inputactions
new file mode 100644
index 0000000..0be9b38
--- /dev/null
+++ b/Assets/Scripts/GameInputs.inputactions
@@ -0,0 +1,98 @@
+{
+ "name": "GameInputs",
+ "maps": [
+ {
+ "name": "Player",
+ "id": "eb96a956-b7ad-47fd-82f5-b4814e98e6b1",
+ "actions": [
+ {
+ "name": "Movement",
+ "type": "Value",
+ "id": "39923aa3-9a9e-4368-8ceb-bebf8ec65530",
+ "expectedControlType": "Vector2",
+ "processors": "",
+ "interactions": "",
+ "initialStateCheck": true
+ },
+ {
+ "name": "Jump",
+ "type": "Button",
+ "id": "436a199c-9091-4d2b-a0e8-afd8675d45f0",
+ "expectedControlType": "Button",
+ "processors": "",
+ "interactions": "",
+ "initialStateCheck": false
+ }
+ ],
+ "bindings": [
+ {
+ "name": "WASD",
+ "id": "0abdf8dd-305d-410a-9788-0a0b22384fd7",
+ "path": "2DVector(mode=1)",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "Movement",
+ "isComposite": true,
+ "isPartOfComposite": false
+ },
+ {
+ "name": "up",
+ "id": "4a50dfb9-46c0-4d52-ba54-1f4886fb77b8",
+ "path": "/w",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "Movement",
+ "isComposite": false,
+ "isPartOfComposite": true
+ },
+ {
+ "name": "down",
+ "id": "a50e92c0-3106-47f9-9499-ff34ca987d4c",
+ "path": "/s",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "Movement",
+ "isComposite": false,
+ "isPartOfComposite": true
+ },
+ {
+ "name": "left",
+ "id": "89e61e01-d935-4391-a515-c7f7aac8a744",
+ "path": "/a",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "Movement",
+ "isComposite": false,
+ "isPartOfComposite": true
+ },
+ {
+ "name": "right",
+ "id": "3a6ca3be-d76f-4ab1-ae0f-0193d87f36c0",
+ "path": "/d",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "Movement",
+ "isComposite": false,
+ "isPartOfComposite": true
+ },
+ {
+ "name": "",
+ "id": "f79d7b08-89bf-4b67-bba8-5ccaaea5501d",
+ "path": "/space",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "Jump",
+ "isComposite": false,
+ "isPartOfComposite": false
+ }
+ ]
+ }
+ ],
+ "controlSchemes": []
+}
\ No newline at end of file
diff --git a/Assets/Scripts/GameInputs.inputactions.meta b/Assets/Scripts/GameInputs.inputactions.meta
new file mode 100644
index 0000000..76ac33d
--- /dev/null
+++ b/Assets/Scripts/GameInputs.inputactions.meta
@@ -0,0 +1,14 @@
+fileFormatVersion: 2
+guid: a0330ab4382a99645ae0e50fb364cffa
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
+ generateWrapperCode: 1
+ wrapperCodePath:
+ wrapperClassName:
+ wrapperCodeNamespace:
diff --git a/Assets/Scripts/Players.meta b/Assets/Scripts/Players.meta
new file mode 100644
index 0000000..f6e6207
--- /dev/null
+++ b/Assets/Scripts/Players.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 934b658e874666341be45a5f5c63d01e
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Players/PlayerInputHandler.cs b/Assets/Scripts/Players/PlayerInputHandler.cs
new file mode 100644
index 0000000..b1567a5
--- /dev/null
+++ b/Assets/Scripts/Players/PlayerInputHandler.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.InputSystem;
+using UnityEngine.PlayerLoop;
+
+[DefaultExecutionOrder(-100)]
+public class PlayerInputHandler : MonoBehaviour
+{
+ public event EventHandler OnJumpTrigger;
+ public Vector2 MoveDir { get; private set; }
+
+ private GameInputs _input;
+ private bool _isReadyToClear;
+
+
+ private void Awake()
+ {
+ _input = new GameInputs();
+ }
+
+ private void OnEnable()
+ {
+ _input.Player.Enable();
+ }
+
+ private void OnDisable()
+ {
+ _input.Player.Disable();
+ }
+
+ private void Start()
+ {
+ _input.Player.Jump.performed += (InputAction.CallbackContext obj) => OnJumpTrigger?.Invoke(this, EventArgs.Empty);
+ }
+
+ private void Update()
+ {
+ ClearInput();
+ ProcessInput();
+ }
+
+ private void FixedUpdate()
+ {
+ _isReadyToClear = true;
+ }
+
+ private void ProcessInput()
+ {
+ MoveDir = _input.Player.Movement.ReadValue();
+ }
+
+ private void ClearInput()
+ {
+ if (!_isReadyToClear)
+ return;
+
+ MoveDir = Vector2.zero;
+
+ _isReadyToClear = false;
+ }
+}
diff --git a/Assets/Scripts/Players/PlayerInputHandler.cs.meta b/Assets/Scripts/Players/PlayerInputHandler.cs.meta
new file mode 100644
index 0000000..e8b4817
--- /dev/null
+++ b/Assets/Scripts/Players/PlayerInputHandler.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d0acec35a78e29146a034edf59dec9f4
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Players/PlayerMain.cs b/Assets/Scripts/Players/PlayerMain.cs
new file mode 100644
index 0000000..31ad1b9
--- /dev/null
+++ b/Assets/Scripts/Players/PlayerMain.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public partial class PlayerMain : MonoBehaviour
+{
+ public static PlayerMain Instance {get; private set;}
+
+ private PlayerInputHandler _input;
+ private Rigidbody2D _rigidbody2D;
+
+
+ private void Awake()
+ {
+ if (Instance != null)
+ {
+ Debug.Log(name + " already exist! " + transform);
+ Destroy(gameObject);
+ return;
+ }
+
+ Instance = this;
+
+ _input = GetComponent();
+ _rigidbody2D = GetComponent();
+ }
+
+ private void FixedUpdate()
+ {
+ MovementHandler();
+ }
+}
diff --git a/Assets/Scripts/Players/PlayerMain.cs.meta b/Assets/Scripts/Players/PlayerMain.cs.meta
new file mode 100644
index 0000000..7fcc50e
--- /dev/null
+++ b/Assets/Scripts/Players/PlayerMain.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d673274af6c36104abfc3cb26d0d9d80
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Players/PlayerMain_Movement.cs b/Assets/Scripts/Players/PlayerMain_Movement.cs
new file mode 100644
index 0000000..de6013e
--- /dev/null
+++ b/Assets/Scripts/Players/PlayerMain_Movement.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public partial class PlayerMain
+{
+ [Header("Movement")]
+ [SerializeField] private float speed = 4f;
+
+
+ private void MovementHandler()
+ {
+ Vector2 move = _input.MoveDir;
+ move.y = 0f;
+
+ _rigidbody2D.velocity = move * speed;
+ }
+}
\ No newline at end of file
diff --git a/Assets/Scripts/Players/PlayerMain_Movement.cs.meta b/Assets/Scripts/Players/PlayerMain_Movement.cs.meta
new file mode 100644
index 0000000..c92cd32
--- /dev/null
+++ b/Assets/Scripts/Players/PlayerMain_Movement.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b859ee3383f1a114aaae6285a1fdd829
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/ProjectSettings/SceneTemplateSettings.json b/ProjectSettings/SceneTemplateSettings.json
new file mode 100644
index 0000000..5e97f83
--- /dev/null
+++ b/ProjectSettings/SceneTemplateSettings.json
@@ -0,0 +1,121 @@
+{
+ "templatePinStates": [],
+ "dependencyTypeInfos": [
+ {
+ "userAdded": false,
+ "type": "UnityEngine.AnimationClip",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEditor.Animations.AnimatorController",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.AnimatorOverrideController",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEditor.Audio.AudioMixerController",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.ComputeShader",
+ "defaultInstantiationMode": 1
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.Cubemap",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.GameObject",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEditor.LightingDataAsset",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.LightingSettings",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.Material",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEditor.MonoScript",
+ "defaultInstantiationMode": 1
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.PhysicMaterial",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.PhysicsMaterial2D",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.Rendering.VolumeProfile",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEditor.SceneAsset",
+ "defaultInstantiationMode": 1
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.Shader",
+ "defaultInstantiationMode": 1
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.ShaderVariantCollection",
+ "defaultInstantiationMode": 1
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.Texture",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.Texture2D",
+ "defaultInstantiationMode": 0
+ },
+ {
+ "userAdded": false,
+ "type": "UnityEngine.Timeline.TimelineAsset",
+ "defaultInstantiationMode": 0
+ }
+ ],
+ "defaultDependencyTypeInfo": {
+ "userAdded": false,
+ "type": "",
+ "defaultInstantiationMode": 1
+ },
+ "newSceneOverride": 0
+}
\ No newline at end of file