From e04ef0c6139e8f82ac4a30227aa634cb6466f299 Mon Sep 17 00:00:00 2001 From: "aube.lee" Date: Tue, 28 Jan 2025 18:45:33 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A1=B0=EC=9D=B4=EC=8A=A4=ED=8B=B1=20=20?= =?UTF-8?q?=EB=8F=99=EC=9E=91=EC=9D=B4=20=EC=9E=90=EC=97=B0=EC=8A=A4?= =?UTF-8?q?=EB=9F=BD=EA=B2=8C=20=EA=B5=AC=ED=98=84=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EC=97=90=EB=94=94?= =?UTF-8?q?=ED=84=B0=20=EC=83=81=EC=97=90=EC=84=9C=20=EC=A2=8C=EC=9A=B0=20?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=EA=B3=BC=20=EC=A0=90=ED=94=84=20=EB=8F=99?= =?UTF-8?q?=EC=9E=91=20=EC=B6=94=EA=B0=80=20=EC=A0=81=EC=9A=A9=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Gameton/Resources/UI/Prefabs/Player.meta | 8 + .../UI/Prefabs/Player/TON.Player.prefab | 182 +++++++++++++ .../UI/Prefabs/Player/TON.Player.prefab.meta | 7 + .../UI/Prefabs/UI.ControllerUI.prefab | 30 ++- .../dev_jinjoo/Edit_Ingame.unity | 247 +++++------------- .../Scripts/Character/CharacterBase.cs | 67 +++-- .../Assets/Gameton/Scripts/Common/UIBase.cs | 9 +- .../Gameton/Scripts/Joystick/Joystick.cs | 4 + .../Scripts/Joystick/VariableJoystick.cs | 3 + .../Assets/Gameton/Scripts/UI/ControllerUI.cs | 13 +- Gameton-06/ProjectSettings/TagManager.asset | 4 +- 11 files changed, 367 insertions(+), 207 deletions(-) create mode 100644 Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player.meta create mode 100644 Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player/TON.Player.prefab create mode 100644 Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player/TON.Player.prefab.meta diff --git a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player.meta b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player.meta new file mode 100644 index 00000000..1c6c4555 --- /dev/null +++ b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8e0dc27a2b893304ca54c494d3f031ba +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player/TON.Player.prefab b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player/TON.Player.prefab new file mode 100644 index 00000000..e8dc47b3 --- /dev/null +++ b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player/TON.Player.prefab @@ -0,0 +1,182 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3727900396484012880 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1540208527192873109} + - component: {fileID: 7924180024803085435} + - component: {fileID: 8127942116504678838} + - component: {fileID: 4492421443313798052} + - component: {fileID: 2615979215924132098} + - component: {fileID: 6673825390847085769} + m_Layer: 0 + m_Name: TON.Player + m_TagString: Player + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1540208527192873109 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3727900396484012880} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -2.29, y: -1.47, z: 0} + m_LocalScale: {x: 5, y: 5, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &7924180024803085435 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3727900396484012880} + 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: 10913, guid: 0000000000000000f000000000000000, type: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.2, y: 0.2} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!70 &8127942116504678838 +CapsuleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3727900396484012880} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_Size: {x: 0.2, y: 0.2} + m_Direction: 0 +--- !u!50 &4492421443313798052 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3727900396484012880} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!114 &2615979215924132098 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3727900396484012880} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1e5d5ec74000134290431a712ebd683, type: 3} + m_Name: + m_EditorClassIdentifier: + groundLayer: + serializedVersion: 2 + m_Bits: 0 +--- !u!114 &6673825390847085769 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3727900396484012880} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 163a5df0eeadca842adba0310b08b93e, type: 3} + m_Name: + m_EditorClassIdentifier: + speed: 3 + jumpForce: 10 + rb: {fileID: 4492421443313798052} diff --git a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player/TON.Player.prefab.meta b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player/TON.Player.prefab.meta new file mode 100644 index 00000000..14e84e5c --- /dev/null +++ b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Player/TON.Player.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a44eee8bbac0660468d7a047fdcecbb9 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ControllerUI.prefab b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ControllerUI.prefab index d77615de..3fea9a8f 100644 --- a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ControllerUI.prefab +++ b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ControllerUI.prefab @@ -116,7 +116,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3675204183f70fb48a77841d2b9055f4, type: 3} m_Name: m_EditorClassIdentifier: + eventSystem: {fileID: 0} joystick: {fileID: 7288066023221573359} + linkedCharactor: {fileID: 0} --- !u!1 &2053873117425800803 GameObject: m_ObjectHideFlags: 0 @@ -371,7 +373,19 @@ MonoBehaviour: m_TargetGraphic: {fileID: 790267721355862019} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: -4577297331876422106} + m_TargetAssemblyTypeName: TON.ControllerUI, Assembly-CSharp + m_MethodName: OnClickAttackButton + m_Mode: 1 + 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 --- !u!1 &6698720259494018033 GameObject: m_ObjectHideFlags: 0 @@ -492,7 +506,19 @@ MonoBehaviour: m_TargetGraphic: {fileID: 2198211765074557333} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: -4577297331876422106} + m_TargetAssemblyTypeName: TON.ControllerUI, Assembly-CSharp + m_MethodName: OnClickJumpButton + m_Mode: 1 + 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 --- !u!1 &7098794055699103870 GameObject: m_ObjectHideFlags: 0 diff --git a/Gameton-06/Assets/Gameton/Scenes/Personal Scenes/dev_jinjoo/Edit_Ingame.unity b/Gameton-06/Assets/Gameton/Scenes/Personal Scenes/dev_jinjoo/Edit_Ingame.unity index d35b561b..79250b79 100644 --- a/Gameton-06/Assets/Gameton/Scenes/Personal Scenes/dev_jinjoo/Edit_Ingame.unity +++ b/Gameton-06/Assets/Gameton/Scenes/Personal Scenes/dev_jinjoo/Edit_Ingame.unity @@ -135,7 +135,7 @@ GameObject: - component: {fileID: 116971772} m_Layer: 0 m_Name: 2D Level - m_TagString: Untagged + m_TagString: Ground m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 @@ -450,7 +450,7 @@ GameObject: - component: {fileID: 1268941403} m_Layer: 0 m_Name: 2D Level (1) - m_TagString: Untagged + m_TagString: Ground m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 @@ -567,186 +567,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1631563207 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1631563211} - - component: {fileID: 1631563210} - - component: {fileID: 1631563209} - - component: {fileID: 1631563208} - - component: {fileID: 1631563212} - - component: {fileID: 1631563213} - m_Layer: 0 - m_Name: TON.Player - m_TagString: Player - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!50 &1631563208 -Rigidbody2D: - serializedVersion: 4 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1631563207} - m_BodyType: 0 - m_Simulated: 1 - m_UseFullKinematicContacts: 0 - m_UseAutoMass: 0 - m_Mass: 1 - m_LinearDrag: 0 - m_AngularDrag: 0.05 - m_GravityScale: 1 - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_Interpolate: 0 - m_SleepingMode: 1 - m_CollisionDetection: 0 - m_Constraints: 0 ---- !u!70 &1631563209 -CapsuleCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1631563207} - m_Enabled: 1 - m_Density: 1 - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_ForceSendLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_ForceReceiveLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_ContactCaptureLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_CallbackLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_IsTrigger: 0 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: 0, y: 0} - m_Size: {x: 0.2, y: 0.2} - m_Direction: 0 ---- !u!212 &1631563210 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1631563207} - 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: 10913, guid: 0000000000000000f000000000000000, type: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 0.2, y: 0.2} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 ---- !u!4 &1631563211 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1631563207} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -2.29, y: -1.47, z: 0} - m_LocalScale: {x: 5, y: 5, z: 0} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1631563212 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1631563207} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b1e5d5ec74000134290431a712ebd683, type: 3} - m_Name: - m_EditorClassIdentifier: - groundLayer: - serializedVersion: 2 - m_Bits: 0 ---- !u!114 &1631563213 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1631563207} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 163a5df0eeadca842adba0310b08b93e, type: 3} - m_Name: - m_EditorClassIdentifier: - speed: 10 - joystick: {fileID: 0} - rb: {fileID: 1631563208} --- !u!1 &1795290567 GameObject: m_ObjectHideFlags: 0 @@ -917,6 +737,67 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1001 &8468278365748754255 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1540208527192873109, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: m_LocalPosition.x + value: -2.29 + objectReference: {fileID: 0} + - target: {fileID: 1540208527192873109, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: m_LocalPosition.y + value: -1.47 + objectReference: {fileID: 0} + - target: {fileID: 1540208527192873109, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1540208527192873109, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1540208527192873109, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1540208527192873109, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1540208527192873109, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1540208527192873109, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1540208527192873109, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1540208527192873109, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3727900396484012880, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: m_Name + value: TON.Player + objectReference: {fileID: 0} + - target: {fileID: 6673825390847085769, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} + propertyPath: jumpForce + value: 5 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: a44eee8bbac0660468d7a047fdcecbb9, type: 3} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 @@ -929,4 +810,4 @@ SceneRoots: - {fileID: 116971771} - {fileID: 1268941405} - {fileID: 1128113573} - - {fileID: 1631563211} + - {fileID: 8468278365748754255} diff --git a/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs b/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs index a25d4c93..0b6937eb 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs @@ -6,39 +6,72 @@ namespace TON { public class CharacterBase : MonoBehaviour { + public float speed; - public VariableJoystick joystick; + public float jumpForce = 10f; // 점프 힘 + private bool isGrounded = true; // 플레이어가 바닥에 있는지 여부를 판단 + + private VariableJoystick joystick; public Rigidbody2D rb; + public void Start() { joystick = ControllerUI.Instance.joystick; + ControllerUI.Instance.linkedCharactor = this; } public void FixedUpdate() { - if (joystick != null) + // 키보드 입력과 조이스틱 입력 통합 + float horizontalInput = Input.GetAxis("Horizontal"); // 키보드 좌우 입력 + if (joystick != null && Mathf.Abs(joystick.Horizontal) > 0.01f) { - Debug.Log($"Horizontal Input: {joystick.input.x}, {joystick.input.y}"); - Debug.Log($"Horizontal Horizontal: {joystick.Horizontal}"); - Debug.Log($"Horizontal Direction: {joystick.Direction}"); + horizontalInput = joystick.Horizontal; // 조이스틱 입력 우선 + } - // 조이스틱의 Horizontal 값 가져오기 - float horizontalInput = joystick.Horizontal; + // 좌우 이동 처리 (X축 속도 설정) + float newVelocityX = horizontalInput * speed; - // 입력값이 0이 아닐 때만 처리 - if (Mathf.Abs(horizontalInput) > 0.0f) - { - // 현재 위치 가져오기 - Vector2 currentPosition = rb.position; + // Rigidbody2D의 속도 업데이트 (X축은 입력값 기반, Y축은 중력/점프 유지) + rb.velocity = new Vector2(newVelocityX, rb.velocity.y); - // 새로운 X 위치 계산 - float newXPosition = currentPosition.x + horizontalInput * speed * Time.fixedDeltaTime; + // 디버그용 출력 + // Debug.Log($"Horizontal Input: {horizontalInput}, Velocity: {rb.velocity}"); + } - // Rigidbody2D의 위치 업데이트 - rb.MovePosition(new Vector2(newXPosition, currentPosition.y)); - } + public void Jump() + { + // 바닥에 있을 때만 점프 가능 + if (isGrounded) + { + Debug.Log("Character Jump"); + + // 점프: 기존 X축 속도 유지, Y축 속도를 점프 힘으로 설정 + rb.velocity = new Vector2(rb.velocity.x, jumpForce); + + // 점프 상태로 설정 + isGrounded = false; } } + + // 바닥 충돌 감지 (2D Physics) + private void OnCollisionEnter2D(Collision2D collision) + { + // Ground 태그가 붙은 오브젝트와 충돌 시 바닥 상태로 전환 + if (collision.gameObject.CompareTag("Ground")) + { + isGrounded = true; + } + } + + public void Attack() + { + Debug.Log("character Attack"); + } + + + + } } diff --git a/Gameton-06/Assets/Gameton/Scripts/Common/UIBase.cs b/Gameton-06/Assets/Gameton/Scripts/Common/UIBase.cs index f3e42ad8..d2444fca 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Common/UIBase.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Common/UIBase.cs @@ -6,9 +6,16 @@ namespace TON { public class UIBase : MonoBehaviour { + public Object eventSystem; public virtual void Show() { - Instantiate(Resources.Load("EventSystem/Prefabs/TON.EventSystem")); + // eventSystem이 현재 씬에 존재하지 않는 경우 + if (eventSystem == null) + { + // UI EventSystem 정상 동작 되도록 GameObject Load + eventSystem = Instantiate(Resources.Load("EventSystem/Prefabs/TON.EventSystem")); + } + gameObject.SetActive(true); } diff --git a/Gameton-06/Assets/Gameton/Scripts/Joystick/Joystick.cs b/Gameton-06/Assets/Gameton/Scripts/Joystick/Joystick.cs index 1526c597..99e8b2bb 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Joystick/Joystick.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Joystick/Joystick.cs @@ -5,6 +5,10 @@ using UnityEngine.EventSystems; namespace TON { + + /// + /// Joystick Assets에서 가져온 조이스틱 기본 동작 스크립트 + /// public class Joystick : MonoBehaviour, IPointerDownHandler, IDragHandler, IPointerUpHandler { public float Horizontal { get { return (snapX) ? SnapFloat(input.x, AxisOptions.Horizontal) : input.x; } } diff --git a/Gameton-06/Assets/Gameton/Scripts/Joystick/VariableJoystick.cs b/Gameton-06/Assets/Gameton/Scripts/Joystick/VariableJoystick.cs index 3a0aee65..f8d21e82 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Joystick/VariableJoystick.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Joystick/VariableJoystick.cs @@ -5,6 +5,9 @@ using UnityEngine.EventSystems; namespace TON { + /// + /// Joystick Assets에서 가져온 조이스틱 초기화 스크립트 + /// public class VariableJoystick : Joystick { public float MoveThreshold { get { return moveThreshold; } set { moveThreshold = Mathf.Abs(value); } } diff --git a/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI.cs b/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI.cs index 04dfb866..5df9c4c1 100644 --- a/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI.cs +++ b/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI.cs @@ -9,10 +9,19 @@ namespace TON { public static ControllerUI Instance => UIManager.Singleton.GetUI(UIList.ControllerUI); + /// 조이스틱에서 컨트롤된 x 값을 Player에서 사용할 수 있도록 객체화 public VariableJoystick joystick; - private void Start() - { + public CharacterBase linkedCharactor { get; set; } + + public void OnClickJumpButton() + { + linkedCharactor.Jump(); + } + + public void OnClickAttackButton() + { + linkedCharactor.Attack(); } } } diff --git a/Gameton-06/ProjectSettings/TagManager.asset b/Gameton-06/ProjectSettings/TagManager.asset index 4b69f598..1d5e6dd0 100644 --- a/Gameton-06/ProjectSettings/TagManager.asset +++ b/Gameton-06/ProjectSettings/TagManager.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e18b1c820e9c09e16bbd1f1b7842e9fb3b0158a0921b0964e0b8fa12c6e2c01 -size 378 +oid sha256:d25c03a2601cbceff75c5ee914d936ec7dd99257e21fc6c6bda1f38ea31046c2 +size 386