fix: 캐릭터가 벽에 충돌했을때 추락하게 하도록 로직 적용
This commit is contained in:
@@ -1,5 +1,129 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1683425442026523196
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 427864611187260801}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Ground Check
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &427864611187260801
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1683425442026523196}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: -0.01, y: 0.04, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 8528093570479225059}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &2164958371881100909
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1793695631517267361}
|
||||||
|
- component: {fileID: 780589065329392038}
|
||||||
|
- component: {fileID: 6824007025137790925}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Wall Checker
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1793695631517267361
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2164958371881100909}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: -0.0092, y: 0.1483, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 8528093570479225059}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!61 &780589065329392038
|
||||||
|
BoxCollider2D:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2164958371881100909}
|
||||||
|
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: 1
|
||||||
|
m_UsedByEffector: 0
|
||||||
|
m_UsedByComposite: 0
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_SpriteTilingProperty:
|
||||||
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
pivot: {x: 0, y: 0}
|
||||||
|
oldSize: {x: 0, y: 0}
|
||||||
|
newSize: {x: 0, y: 0}
|
||||||
|
adaptiveTilingThreshold: 0
|
||||||
|
drawMode: 0
|
||||||
|
adaptiveTiling: 0
|
||||||
|
m_AutoTiling: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 0.25, y: 0.15}
|
||||||
|
m_EdgeRadius: 0
|
||||||
|
--- !u!114 &6824007025137790925
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2164958371881100909}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 75a6dd00ee9c3d7428cae5700b2cc666, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
groundLayer:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 512
|
||||||
--- !u!1 &2757306338607502731
|
--- !u!1 &2757306338607502731
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -42,7 +166,7 @@ GameObject:
|
|||||||
- component: {fileID: 8528093570479225059}
|
- component: {fileID: 8528093570479225059}
|
||||||
- component: {fileID: 6967183450965278935}
|
- component: {fileID: 6967183450965278935}
|
||||||
- component: {fileID: 8059802051760727483}
|
- component: {fileID: 8059802051760727483}
|
||||||
- component: {fileID: 880817811453911241}
|
- component: {fileID: 292703337309736025}
|
||||||
- component: {fileID: 4986202531950816680}
|
- component: {fileID: 4986202531950816680}
|
||||||
- component: {fileID: 2392205422319772847}
|
- component: {fileID: 2392205422319772847}
|
||||||
- component: {fileID: 7649288990551335566}
|
- component: {fileID: 7649288990551335566}
|
||||||
@@ -62,12 +186,14 @@ Transform:
|
|||||||
m_GameObject: {fileID: 3656570700648378249}
|
m_GameObject: {fileID: 3656570700648378249}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -2.36, y: -1.5, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 5, y: 5, z: 0}
|
m_LocalScale: {x: 5, y: 5, z: 0}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3571909985532505043}
|
- {fileID: 3571909985532505043}
|
||||||
- {fileID: 6308497305587874648}
|
- {fileID: 6308497305587874648}
|
||||||
|
- {fileID: 427864611187260801}
|
||||||
|
- {fileID: 1793695631517267361}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!212 &6967183450965278935
|
--- !u!212 &6967183450965278935
|
||||||
@@ -143,8 +269,8 @@ Animator:
|
|||||||
m_AllowConstantClipSamplingOptimization: 1
|
m_AllowConstantClipSamplingOptimization: 1
|
||||||
m_KeepAnimatorStateOnDisable: 0
|
m_KeepAnimatorStateOnDisable: 0
|
||||||
m_WriteDefaultValuesOnDisable: 0
|
m_WriteDefaultValuesOnDisable: 0
|
||||||
--- !u!61 &880817811453911241
|
--- !u!70 &292703337309736025
|
||||||
BoxCollider2D:
|
CapsuleCollider2D:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
@@ -175,19 +301,9 @@ BoxCollider2D:
|
|||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
m_UsedByEffector: 0
|
m_UsedByEffector: 0
|
||||||
m_UsedByComposite: 0
|
m_UsedByComposite: 0
|
||||||
m_Offset: {x: -0.015000001, y: 0.13}
|
m_Offset: {x: -0.01, y: 0.135}
|
||||||
m_SpriteTilingProperty:
|
m_Size: {x: 0.12, y: 0.18}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
m_Direction: 0
|
||||||
pivot: {x: 0.6, y: -0.21052632}
|
|
||||||
oldSize: {x: 0.15, y: 0.19}
|
|
||||||
newSize: {x: 0.2, y: 0.2}
|
|
||||||
adaptiveTilingThreshold: 0.5
|
|
||||||
drawMode: 0
|
|
||||||
adaptiveTiling: 0
|
|
||||||
m_AutoTiling: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Size: {x: 0.13, y: 0.18}
|
|
||||||
m_EdgeRadius: 0
|
|
||||||
--- !u!50 &4986202531950816680
|
--- !u!50 &4986202531950816680
|
||||||
Rigidbody2D:
|
Rigidbody2D:
|
||||||
serializedVersion: 4
|
serializedVersion: 4
|
||||||
@@ -242,15 +358,31 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 163a5df0eeadca842adba0310b08b93e, type: 3}
|
m_Script: {fileID: 11500000, guid: 163a5df0eeadca842adba0310b08b93e, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
playerData:
|
||||||
|
id:
|
||||||
|
type:
|
||||||
|
name:
|
||||||
|
level: 0
|
||||||
|
experience: 0
|
||||||
|
hp: 0
|
||||||
|
mp: 0
|
||||||
|
attackPower: 0
|
||||||
|
defensivePower: 0
|
||||||
|
critical: 0
|
||||||
currentHP: 0
|
currentHP: 0
|
||||||
maxHP: 0
|
|
||||||
currentSP: 0
|
currentSP: 0
|
||||||
maxSP: 0
|
|
||||||
speed: 3
|
speed: 3
|
||||||
jumpForce: 8
|
jumpForce: 8
|
||||||
|
airControl: 0.8
|
||||||
|
sideCheckDistance: 0.5
|
||||||
|
groundCheck: {fileID: 427864611187260801}
|
||||||
|
groundCheckRadius: 0.1
|
||||||
|
groundLayer:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 512
|
||||||
|
wallChecker: {fileID: 6824007025137790925}
|
||||||
firePoint: {fileID: 3571909985532505043}
|
firePoint: {fileID: 3571909985532505043}
|
||||||
attackCollider: {fileID: 3772826248857896723}
|
attackCollider: {fileID: 3772826248857896723}
|
||||||
animator: {fileID: 0}
|
|
||||||
rb: {fileID: 4986202531950816680}
|
rb: {fileID: 4986202531950816680}
|
||||||
--- !u!1 &6930308287002930140
|
--- !u!1 &6930308287002930140
|
||||||
GameObject:
|
GameObject:
|
||||||
|
|||||||
@@ -1,5 +1,126 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &946989082622396807
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 777487253851638430}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Ground Check
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &777487253851638430
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 946989082622396807}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: -0.01, y: 0.04, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 8528093570479225059}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &1886314844740901613
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4803398892385748894}
|
||||||
|
- component: {fileID: 2394062811346782473}
|
||||||
|
- component: {fileID: 6530647677844077835}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Wall Checker
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &4803398892385748894
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1886314844740901613}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: -0.0092, y: 0.1483, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 0}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 8528093570479225059}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!61 &2394062811346782473
|
||||||
|
BoxCollider2D:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1886314844740901613}
|
||||||
|
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: 1
|
||||||
|
m_UsedByEffector: 0
|
||||||
|
m_UsedByComposite: 0
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_SpriteTilingProperty:
|
||||||
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
pivot: {x: 0, y: 0}
|
||||||
|
oldSize: {x: 0, y: 0}
|
||||||
|
newSize: {x: 0, y: 0}
|
||||||
|
adaptiveTilingThreshold: 0
|
||||||
|
drawMode: 0
|
||||||
|
adaptiveTiling: 0
|
||||||
|
m_AutoTiling: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 0.25, y: 0.15}
|
||||||
|
m_EdgeRadius: 0
|
||||||
|
--- !u!114 &6530647677844077835
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1886314844740901613}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 75a6dd00ee9c3d7428cae5700b2cc666, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &3656570700648378249
|
--- !u!1 &3656570700648378249
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -11,7 +132,7 @@ GameObject:
|
|||||||
- component: {fileID: 8528093570479225059}
|
- component: {fileID: 8528093570479225059}
|
||||||
- component: {fileID: 6967183450965278935}
|
- component: {fileID: 6967183450965278935}
|
||||||
- component: {fileID: 8059802051760727483}
|
- component: {fileID: 8059802051760727483}
|
||||||
- component: {fileID: 880817811453911241}
|
- component: {fileID: 258578364601596647}
|
||||||
- component: {fileID: 4986202531950816680}
|
- component: {fileID: 4986202531950816680}
|
||||||
- component: {fileID: 2392205422319772847}
|
- component: {fileID: 2392205422319772847}
|
||||||
- component: {fileID: 7649288990551335566}
|
- component: {fileID: 7649288990551335566}
|
||||||
@@ -31,12 +152,14 @@ Transform:
|
|||||||
m_GameObject: {fileID: 3656570700648378249}
|
m_GameObject: {fileID: 3656570700648378249}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -2.36, y: -1.5, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 5, y: 5, z: 0}
|
m_LocalScale: {x: 5, y: 5, z: 0}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3204799031628172313}
|
- {fileID: 3204799031628172313}
|
||||||
- {fileID: 548404723012153258}
|
- {fileID: 548404723012153258}
|
||||||
|
- {fileID: 777487253851638430}
|
||||||
|
- {fileID: 4803398892385748894}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!212 &6967183450965278935
|
--- !u!212 &6967183450965278935
|
||||||
@@ -112,8 +235,8 @@ Animator:
|
|||||||
m_AllowConstantClipSamplingOptimization: 1
|
m_AllowConstantClipSamplingOptimization: 1
|
||||||
m_KeepAnimatorStateOnDisable: 0
|
m_KeepAnimatorStateOnDisable: 0
|
||||||
m_WriteDefaultValuesOnDisable: 0
|
m_WriteDefaultValuesOnDisable: 0
|
||||||
--- !u!61 &880817811453911241
|
--- !u!70 &258578364601596647
|
||||||
BoxCollider2D:
|
CapsuleCollider2D:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
@@ -144,19 +267,9 @@ BoxCollider2D:
|
|||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
m_UsedByEffector: 0
|
m_UsedByEffector: 0
|
||||||
m_UsedByComposite: 0
|
m_UsedByComposite: 0
|
||||||
m_Offset: {x: -0.015000001, y: 0.13}
|
m_Offset: {x: -0.01, y: 0.135}
|
||||||
m_SpriteTilingProperty:
|
m_Size: {x: 0.12, y: 0.18}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
m_Direction: 0
|
||||||
pivot: {x: 0.6, y: -0.21052632}
|
|
||||||
oldSize: {x: 0.15, y: 0.19}
|
|
||||||
newSize: {x: 0.2, y: 0.2}
|
|
||||||
adaptiveTilingThreshold: 0.5
|
|
||||||
drawMode: 0
|
|
||||||
adaptiveTiling: 0
|
|
||||||
m_AutoTiling: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Size: {x: 0.13, y: 0.18}
|
|
||||||
m_EdgeRadius: 0
|
|
||||||
--- !u!50 &4986202531950816680
|
--- !u!50 &4986202531950816680
|
||||||
Rigidbody2D:
|
Rigidbody2D:
|
||||||
serializedVersion: 4
|
serializedVersion: 4
|
||||||
@@ -211,15 +324,30 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 163a5df0eeadca842adba0310b08b93e, type: 3}
|
m_Script: {fileID: 11500000, guid: 163a5df0eeadca842adba0310b08b93e, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
playerData:
|
||||||
|
id:
|
||||||
|
type:
|
||||||
|
name:
|
||||||
|
level: 0
|
||||||
|
experience: 0
|
||||||
|
hp: 0
|
||||||
|
mp: 0
|
||||||
|
attackPower: 0
|
||||||
|
defensivePower: 0
|
||||||
|
critical: 0
|
||||||
currentHP: 0
|
currentHP: 0
|
||||||
maxHP: 0
|
|
||||||
currentSP: 0
|
currentSP: 0
|
||||||
maxSP: 0
|
|
||||||
speed: 3
|
speed: 3
|
||||||
jumpForce: 8
|
jumpForce: 8
|
||||||
|
airControl: 0.8
|
||||||
|
groundCheck: {fileID: 777487253851638430}
|
||||||
|
groundCheckRadius: 0.15
|
||||||
|
groundLayer:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 512
|
||||||
|
wallChecker: {fileID: 6530647677844077835}
|
||||||
firePoint: {fileID: 3204799031628172313}
|
firePoint: {fileID: 3204799031628172313}
|
||||||
attackCollider: {fileID: 5093782900058509363}
|
attackCollider: {fileID: 5093782900058509363}
|
||||||
animator: {fileID: 0}
|
|
||||||
rb: {fileID: 4986202531950816680}
|
rb: {fileID: 4986202531950816680}
|
||||||
--- !u!1 &4475587780921916628
|
--- !u!1 &4475587780921916628
|
||||||
GameObject:
|
GameObject:
|
||||||
|
|||||||
@@ -7,25 +7,29 @@ namespace TON
|
|||||||
public class CharacterBase : MonoBehaviour, IDamage
|
public class CharacterBase : MonoBehaviour, IDamage
|
||||||
{
|
{
|
||||||
|
|
||||||
[SerializeField] //
|
[SerializeField] private PlayerData playerData;
|
||||||
private PlayerData playerData;
|
[SerializeField] private float currentHP;
|
||||||
public float currentHP;
|
[SerializeField] private float currentSP;
|
||||||
public float maxHP;
|
private float maxHP;
|
||||||
public float currentSP;
|
private float maxSP;
|
||||||
public float maxSP;
|
|
||||||
|
[SerializeField] private float speed;
|
||||||
|
[SerializeField] private float jumpForce = 5f; // 점프 힘
|
||||||
|
[SerializeField] private float airControl; // 점프 힘
|
||||||
|
|
||||||
|
[SerializeField] private Transform groundCheck; // GroundCheck 위치 설정
|
||||||
|
[SerializeField] private float groundCheckRadius = 0.2f;
|
||||||
|
[SerializeField] private LayerMask groundLayer;
|
||||||
|
[SerializeField] private WallChecker wallChecker;
|
||||||
|
|
||||||
|
|
||||||
public float speed;
|
|
||||||
public float jumpForce = 5f; // 점프 힘
|
|
||||||
private bool isGrounded = true; // 플레이어가 바닥에 있는지 여부를 판단
|
private bool isGrounded = true; // 플레이어가 바닥에 있는지 여부를 판단
|
||||||
private float lastDirection = 1f; // 기본적으로 오른쪽(1) 바라보는 상태
|
private float lastDirection = 1f; // 기본적으로 오른쪽(1) 바라보는 상태
|
||||||
|
private VariableJoystick joystick;
|
||||||
|
private Animator animator;
|
||||||
|
|
||||||
public Transform firePoint; // 스킬 발사 위치
|
public Transform firePoint; // 스킬 발사 위치
|
||||||
public CollisionDetector attackCollider; // 기본 공격 감지를 위한 자식 오브젝트
|
public CollisionDetector attackCollider; // 기본 공격 감지를 위한 자식 오브젝트
|
||||||
|
|
||||||
public Animator animator;
|
|
||||||
|
|
||||||
private VariableJoystick joystick;
|
|
||||||
public Rigidbody2D rb;
|
public Rigidbody2D rb;
|
||||||
|
|
||||||
// ingame UI의 캐릭터 stat 적용을 위한 이벤트
|
// ingame UI의 캐릭터 stat 적용을 위한 이벤트
|
||||||
@@ -73,8 +77,25 @@ namespace TON
|
|||||||
PlayerDataManager.Singleton.UpdatePlayerData();
|
PlayerDataManager.Singleton.UpdatePlayerData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 게임이 실행 중이지 않을 때도 항상 기즈모를 보여줍니다
|
||||||
|
private void OnDrawGizmos()
|
||||||
|
{
|
||||||
|
if (groundCheck == null) return;
|
||||||
|
|
||||||
|
// 기본 색상을 흰색으로 설정
|
||||||
|
Gizmos.color = Color.red;
|
||||||
|
// OverlapCircle의 범위를 와이어프레임 원으로 표시
|
||||||
|
Gizmos.DrawWireSphere(groundCheck.position, groundCheckRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CheckIsGrounded()
|
||||||
|
{
|
||||||
|
return Physics2D.OverlapCircle(groundCheck.position, groundCheckRadius, groundLayer);
|
||||||
|
}
|
||||||
|
|
||||||
public void FixedUpdate()
|
public void FixedUpdate()
|
||||||
{
|
{
|
||||||
|
isGrounded = CheckIsGrounded();
|
||||||
|
|
||||||
// 키보드 입력과 조이스틱 입력 통합
|
// 키보드 입력과 조이스틱 입력 통합
|
||||||
float horizontalInput = Input.GetAxis("Horizontal");
|
float horizontalInput = Input.GetAxis("Horizontal");
|
||||||
@@ -86,31 +107,45 @@ namespace TON
|
|||||||
// 걷는 애니메이션 적용
|
// 걷는 애니메이션 적용
|
||||||
animator.SetBool("IsMoving", Mathf.Abs(horizontalInput) > 0f);
|
animator.SetBool("IsMoving", Mathf.Abs(horizontalInput) > 0f);
|
||||||
|
|
||||||
// 기본 이동 속도 계산
|
// 공중/지상에 따른 이동 속도 계산
|
||||||
float newVelocityX = horizontalInput * speed;
|
|
||||||
|
|
||||||
// 경사로 감지
|
Debug.Log("wallChecker.IsWallTouching::: " + wallChecker.IsWallTouching);
|
||||||
bool isOnSlope = false;
|
// 측면 충돌 체크
|
||||||
Vector2 rayOrigin = rb.position;
|
if (!isGrounded && wallChecker.IsWallTouching)
|
||||||
RaycastHit2D hit = Physics2D.Raycast(rayOrigin, Vector2.down, 1.1f);
|
|
||||||
|
|
||||||
if (hit.collider != null && hit.collider.CompareTag("Ground")) // Ground 태그 확인
|
|
||||||
{
|
{
|
||||||
float slopeAngle = Vector2.Angle(hit.normal, Vector2.up);
|
// 벽을 밀고 있을 때는 수평 이동 제한
|
||||||
if (slopeAngle > 0 && slopeAngle <= 45f)
|
rb.velocity = new Vector2(0, rb.velocity.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 기본 이동 속도 계산
|
||||||
|
float newVelocityX = horizontalInput * (isGrounded ? speed : speed * airControl);
|
||||||
|
|
||||||
|
// 경사로 감지
|
||||||
|
bool isOnSlope = false;
|
||||||
|
Vector2 rayOrigin = rb.position;
|
||||||
|
RaycastHit2D hit = Physics2D.Raycast(rayOrigin, Vector2.down, 1.1f);
|
||||||
|
|
||||||
|
if (!isGrounded) // Ground 충돌 확인
|
||||||
{
|
{
|
||||||
isOnSlope = true;
|
float slopeAngle = Vector2.Angle(hit.normal, Vector2.up);
|
||||||
// 경사면 방향 벡터 계산
|
if (slopeAngle > 0 && slopeAngle <= 45f)
|
||||||
Vector2 slopeDirection = new Vector2(hit.normal.y, -hit.normal.x);
|
{
|
||||||
rb.velocity = slopeDirection * (newVelocityX / Mathf.Cos(slopeAngle * Mathf.Deg2Rad));
|
isOnSlope = true;
|
||||||
|
// 경사면 방향 벡터 계산
|
||||||
|
Vector2 slopeDirection = new Vector2(hit.normal.y, -hit.normal.x);
|
||||||
|
rb.velocity = slopeDirection * (newVelocityX / Mathf.Cos(slopeAngle * Mathf.Deg2Rad));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 경사가 아닐 경우 일반 이동 적용
|
||||||
|
if (!isOnSlope)
|
||||||
|
{
|
||||||
|
rb.velocity = new Vector2(newVelocityX, rb.velocity.y);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 경사가 아닐 경우 일반 이동 적용
|
|
||||||
if (!isOnSlope)
|
|
||||||
{
|
|
||||||
rb.velocity = new Vector2(newVelocityX, rb.velocity.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 방향 전환
|
// 방향 전환
|
||||||
if (horizontalInput != 0)
|
if (horizontalInput != 0)
|
||||||
@@ -141,19 +176,6 @@ namespace TON
|
|||||||
{
|
{
|
||||||
// 점프: 기존 X축 속도 유지, Y축 속도를 점프 힘으로 설정
|
// 점프: 기존 X축 속도 유지, Y축 속도를 점프 힘으로 설정
|
||||||
rb.velocity = new Vector2(rb.velocity.x, jumpForce);
|
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24
Gameton-06/Assets/Gameton/Scripts/Character/WallChecker.cs
Normal file
24
Gameton-06/Assets/Gameton/Scripts/Character/WallChecker.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TON
|
||||||
|
{
|
||||||
|
public class WallChecker : MonoBehaviour
|
||||||
|
{
|
||||||
|
public bool IsWallTouching { get; private set; }
|
||||||
|
|
||||||
|
private void OnTriggerStay2D(Collider2D other)
|
||||||
|
{
|
||||||
|
IsWallTouching = other.gameObject.layer == LayerMask.NameToLayer("Ground");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTriggerExit2D(Collider2D other)
|
||||||
|
{
|
||||||
|
if (other.gameObject.layer == LayerMask.NameToLayer("Ground"))
|
||||||
|
{
|
||||||
|
IsWallTouching = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 75a6dd00ee9c3d7428cae5700b2cc666
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user