#42 플레이어 수동 제어로 변경

+ Input System 로직 변경 및 Actions 추가
  ㄴ 컴포넌트 내의 Behavior :
     SendMessage -> Invoke Unity Events
  ㄴ OnEnable, OnDisable에서 이벤트 연결 방식
+ 마우스 왼쪽 키, K 기본 공격
+ 마우스 Space 키 구르기(무적)
+ 구르기 중 Trail 파티클로 임시 표현
+ 공격 시 Trail Particles로 임시 범위 표시
This commit is contained in:
NTG_Lenovo 2023-10-26 16:00:08 +09:00
parent 50841c604f
commit c8d1acec32
5 changed files with 658 additions and 415 deletions

View File

@ -122,151 +122,6 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &13272261
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 13272262}
- component: {fileID: 13272263}
m_Layer: 0
m_Name: TrailEffect
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &13272262
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 13272261}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 1.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1978848785}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!96 &13272263
TrailRenderer:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 13272261}
m_Enabled: 0
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10306, 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: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Time: 0.3
m_PreviewTimeScale: 1
m_Parameters:
serializedVersion: 3
widthMultiplier: 3
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.89373296
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 0, g: 0.941309, b: 1, a: 1}
key1: {r: 0.61470586, g: 0.9773867, b: 1, a: 1}
key2: {r: 1, g: 1, b: 1, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 43754
ctime2: 65535
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_ColorSpace: 0
m_NumColorKeys: 3
m_NumAlphaKeys: 2
numCornerVertices: 0
numCapVertices: 0
alignment: 0
textureMode: 0
textureScale: {x: 1, y: 1}
shadowBias: 0.5
generateLightingData: 0
m_MinVertexDistance: 0.1
m_MaskInteraction: 0
m_Autodestruct: 0
m_Emitting: 1
m_ApplyActiveColorSpace: 0
--- !u!1001 &17330399 --- !u!1001 &17330399
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -341,18 +196,45 @@ Transform:
type: 3} type: 3}
m_PrefabInstance: {fileID: 17330399} m_PrefabInstance: {fileID: 17330399}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &26417291
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 26417292}
m_Layer: 0
m_Name: TrailRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &26417292
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 26417291}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1978848785}
- {fileID: 963016597}
m_Father: {fileID: 418278337}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!224 &29785398 stripped --- !u!224 &29785398 stripped
RectTransform: RectTransform:
m_CorrespondingSourceObject: {fileID: 1423656733108109268, guid: b82511a1823faf14f97c60a0e6984872, m_CorrespondingSourceObject: {fileID: 1423656733108109268, guid: b82511a1823faf14f97c60a0e6984872,
type: 3} type: 3}
m_PrefabInstance: {fileID: 1259135358} m_PrefabInstance: {fileID: 1259135358}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!4 &38469447 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208,
type: 3}
m_PrefabInstance: {fileID: 1633449551}
m_PrefabAsset: {fileID: 0}
--- !u!1 &56326961 stripped --- !u!1 &56326961 stripped
GameObject: GameObject:
m_CorrespondingSourceObject: {fileID: 2718910014188824470, guid: 14871bcccb7cf4e1d81bb38ec7a3a4e0, m_CorrespondingSourceObject: {fileID: 2718910014188824470, guid: 14871bcccb7cf4e1d81bb38ec7a3a4e0,
@ -385,7 +267,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3} - target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 0.9 value: 0.7
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3} - target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
@ -3427,7 +3309,7 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 895707786071648807, guid: 5d3f02c24a243a044bbddafc1652ee67, - targetCorrespondingSourceObject: {fileID: 895707786071648807, guid: 5d3f02c24a243a044bbddafc1652ee67,
type: 3} type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 1978848785} addedObject: {fileID: 26417292}
m_AddedComponents: m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 4681418249284042988, guid: 5d3f02c24a243a044bbddafc1652ee67, - targetCorrespondingSourceObject: {fileID: 4681418249284042988, guid: 5d3f02c24a243a044bbddafc1652ee67,
type: 3} type: 3}
@ -3483,7 +3365,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
<ViewRadius>k__BackingField: 8 <ViewRadius>k__BackingField: 8
<AtkRange>k__BackingField: 1.5 <AtkRange>k__BackingField: 2.5
<Targets>k__BackingField: <Targets>k__BackingField:
- {fileID: 0} - {fileID: 0}
- {fileID: 0} - {fileID: 0}
@ -3527,7 +3409,7 @@ MonoBehaviour:
<CurrentHp>k__BackingField: 0 <CurrentHp>k__BackingField: 0
<MoveSpd>k__BackingField: 5 <MoveSpd>k__BackingField: 5
<Atk>k__BackingField: 10 <Atk>k__BackingField: 10
<AtkCooldown>k__BackingField: 1 <AtkCooldown>k__BackingField: 0.5
<DefenseRange>k__BackingField: 10 <DefenseRange>k__BackingField: 10
<IsRandomMove>k__BackingField: 0 <IsRandomMove>k__BackingField: 0
<RandomMoveRange>k__BackingField: 0 <RandomMoveRange>k__BackingField: 0
@ -3540,10 +3422,14 @@ MonoBehaviour:
<IsCombated>k__BackingField: 0 <IsCombated>k__BackingField: 0
<BeAttackedInIdle>k__BackingField: 0 <BeAttackedInIdle>k__BackingField: 0
<UseRigidbody>k__BackingField: 0 <UseRigidbody>k__BackingField: 0
useMouseAttack: 0
isRolling: 0
beAttacked: 0 beAttacked: 0
isAttacking: 0 isAttacking: 0
attackAngle: 180 attackAngle: 180
angleSpeed: 0.2 angleSpeed: 0.2
rollDuration: 0.5
rollForce: 2
--- !u!114 &418278343 --- !u!114 &418278343
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3551,14 +3437,14 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 418278336} m_GameObject: {fileID: 418278336}
m_Enabled: 0 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Actions: {fileID: -944628639613478452, guid: 0acb404847404484198cbf94e6929af2, m_Actions: {fileID: -944628639613478452, guid: 0acb404847404484198cbf94e6929af2,
type: 3} type: 3}
m_NotificationBehavior: 0 m_NotificationBehavior: 2
m_UIInputModule: {fileID: 0} m_UIInputModule: {fileID: 0}
m_DeviceLostEvent: m_DeviceLostEvent:
m_PersistentCalls: m_PersistentCalls:
@ -3569,7 +3455,79 @@ MonoBehaviour:
m_ControlsChangedEvent: m_ControlsChangedEvent:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_ActionEvents: [] m_ActionEvents:
- m_PersistentCalls:
m_Calls: []
m_ActionId: e46165d9-8066-4400-8950-9b7d4bb9ca75
m_ActionName: 'Player/Move[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 7d9814fb-48e0-4717-91c3-0c7b7d99972c
m_ActionName: 'Player/AssaultMode[/Keyboard/v]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 367e7267-d329-439d-9806-5e960b8114b5
m_ActionName: 'Player/Interaction[/Keyboard/e]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: a28fe5f5-b2a2-4794-8f99-fa2494aedfc3
m_ActionName: 'Player/InteractionHold[/Keyboard/e]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 548e1aff-2de9-4dcc-8fe3-6c20ee0e74d4
m_ActionName: 'Player/Zkey[/Keyboard/z]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: e520b814-2e0b-4d05-853e-ac1a35bb6b51
m_ActionName: 'Player/TakeAim[/Keyboard/space]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: c8a82170-8a07-4432-b22f-9ec40486ed27
m_ActionName: 'Player/Cancel[/Keyboard/f]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: bb26b6ad-feae-49d8-a4d8-3633bcabfcab
m_ActionName: 'Player/Targeting[/Keyboard/q]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: c3e552b9-a9be-4d38-8cde-27cc60f7888f
m_ActionName: 'Player/TargetingHold[/Keyboard/q]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 1558b861-5937-46f7-8887-3f322044049b
m_ActionName: 'Player/SpawnInIsladnPlayer[/Keyboard/t]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: b5508379-f9b3-45f9-ba2e-c16fb67bb36a
m_ActionName: 'Player/CancelHold[/Keyboard/f]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 5042e547-e870-4479-8263-b143f4d03597
m_ActionName: 'Player/Attack[/Mouse/leftButton,/Keyboard/k]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: c68960a5-036f-4304-8d05-25778470ecfd
m_ActionName: 'Player/Roll[/Keyboard/space]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 26cdda4e-9797-43df-a511-7745f1de2567
m_ActionName: 'Camera/Zoom[/Mouse/scroll/y]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: d9db46b6-0228-4e7f-8b51-53cae3ccc330
m_ActionName: 'Camera/Rotate[/Mouse/rightButton,/Mouse/leftButton]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 2c1978d2-b4be-453a-9413-7b54903dbf38
m_ActionName: 'Unit/SelectUnit[/Mouse/leftButton]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 952be7b5-8952-47b7-a2db-ced6517d161a
m_ActionName: 'Unit/CancelSelectedUnit[/Keyboard/escape]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 2fe8434e-42e2-4b88-b0b3-0b2b4f8596a8
m_ActionName: 'Unit/MoveUnit[/Mouse/rightButton]'
m_NeverAutoSwitchControlSchemes: 0 m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme: m_DefaultControlScheme:
m_DefaultActionMap: Player m_DefaultActionMap: Player
@ -3692,7 +3650,7 @@ Rigidbody:
m_ImplicitCom: 1 m_ImplicitCom: 1
m_ImplicitTensor: 1 m_ImplicitTensor: 1
m_UseGravity: 1 m_UseGravity: 1
m_IsKinematic: 1 m_IsKinematic: 0
m_Interpolate: 0 m_Interpolate: 0
m_Constraints: 112 m_Constraints: 112
m_CollisionDetection: 0 m_CollisionDetection: 0
@ -7061,6 +7019,38 @@ NavMeshObstacle:
m_CarveOnlyStationary: 1 m_CarveOnlyStationary: 1
m_Center: {x: -0.09900001, y: 2.229, z: 0.049000002} m_Center: {x: -0.09900001, y: 2.229, z: 0.049000002}
m_TimeToStationary: 0.5 m_TimeToStationary: 0.5
--- !u!1 &963016596
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 963016597}
m_Layer: 0
m_Name: AfterImageTrailRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &963016597
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963016596}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -0.3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1418799782}
m_Father: {fileID: 26417292}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &966288978 --- !u!1001 &966288978
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -10808,6 +10798,109 @@ RectTransform:
type: 3} type: 3}
m_PrefabInstance: {fileID: 1418191462} m_PrefabInstance: {fileID: 1418191462}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1001 &1418799781
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 963016597}
m_Modifications:
- target: {fileID: 144762, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: m_Name
value: IceFloorTrail
objectReference: {fileID: 0}
- target: {fileID: 415538, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: m_LocalPosition.x
value: -0.159
objectReference: {fileID: 0}
- target: {fileID: 415538, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 415538, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: m_LocalPosition.z
value: -0.172
objectReference: {fileID: 0}
- target: {fileID: 415538, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 415538, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 415538, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 415538, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 415538, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 415538, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 415538, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19823998, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: looping
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19823998, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19836762, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: looping
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19836762, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: prewarm
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19836762, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19872990, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: looping
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19872990, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: prewarm
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19872990, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19896610, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: looping
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19896610, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 88cf0884542d69c48a0f59e0f17ade92, type: 3}
--- !u!4 &1418799782 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 415538, guid: 88cf0884542d69c48a0f59e0f17ade92,
type: 3}
m_PrefabInstance: {fileID: 1418799781}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1429303293 --- !u!1001 &1429303293
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -11833,91 +11926,6 @@ Transform:
type: 3} type: 3}
m_PrefabInstance: {fileID: 1629416266} m_PrefabInstance: {fileID: 1629416266}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1001 &1633449551
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1978848785}
m_Modifications:
- target: {fileID: 185524, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_Name
value: SpikyFireTrail
objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalScale.x
value: -1
objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalPosition.z
value: 1.5
objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalRotation.x
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -90
objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19828646, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: looping
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19828646, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19839156, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: looping
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19839156, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19885640, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: looping
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19885640, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: playOnAwake
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
--- !u!1001 &1636445598 --- !u!1001 &1636445598
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -13776,7 +13784,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1978848785} - component: {fileID: 1978848785}
m_Layer: 0 m_Layer: 0
m_Name: TrailRoot m_Name: AttackTrailRoot
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -13790,16 +13798,14 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1978848784} m_GameObject: {fileID: 1978848784}
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: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 13272262}
- {fileID: 38469447}
- {fileID: 1476215451} - {fileID: 1476215451}
- {fileID: 474440006} - {fileID: 474440006}
m_Father: {fileID: 418278337} m_Father: {fileID: 26417292}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!198 &1988695658 --- !u!198 &1988695658
ParticleSystem: ParticleSystem:
@ -23721,7 +23727,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3} - target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 1.2 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3} - target: {fileID: 494686, guid: 7ef15b3b75916c044aa8aa197b362208, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w

View File

@ -134,6 +134,15 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
""processors"": """", ""processors"": """",
""interactions"": """", ""interactions"": """",
""initialStateCheck"": false ""initialStateCheck"": false
},
{
""name"": ""Roll"",
""type"": ""Button"",
""id"": ""c68960a5-036f-4304-8d05-25778470ecfd"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
} }
], ],
""bindings"": [ ""bindings"": [
@ -312,6 +321,28 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
""action"": ""Attack"", ""action"": ""Attack"",
""isComposite"": false, ""isComposite"": false,
""isPartOfComposite"": false ""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""c5b5e8bc-aca9-40bb-8e57-6bb1349f08d0"",
""path"": ""<Keyboard>/k"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""Attack"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""5a134753-6868-4dec-9b0e-5839b48f7417"",
""path"": ""<Keyboard>/space"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""Roll"",
""isComposite"": false,
""isPartOfComposite"": false
} }
] ]
}, },
@ -487,6 +518,7 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
m_Player_SpawnInIsladnPlayer = m_Player.FindAction("SpawnInIsladnPlayer", throwIfNotFound: true); m_Player_SpawnInIsladnPlayer = m_Player.FindAction("SpawnInIsladnPlayer", throwIfNotFound: true);
m_Player_CancelHold = m_Player.FindAction("CancelHold", throwIfNotFound: true); m_Player_CancelHold = m_Player.FindAction("CancelHold", throwIfNotFound: true);
m_Player_Attack = m_Player.FindAction("Attack", throwIfNotFound: true); m_Player_Attack = m_Player.FindAction("Attack", throwIfNotFound: true);
m_Player_Roll = m_Player.FindAction("Roll", throwIfNotFound: true);
// Camera // Camera
m_Camera = asset.FindActionMap("Camera", throwIfNotFound: true); m_Camera = asset.FindActionMap("Camera", throwIfNotFound: true);
m_Camera_Zoom = m_Camera.FindAction("Zoom", throwIfNotFound: true); m_Camera_Zoom = m_Camera.FindAction("Zoom", throwIfNotFound: true);
@ -569,6 +601,7 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
private readonly InputAction m_Player_SpawnInIsladnPlayer; private readonly InputAction m_Player_SpawnInIsladnPlayer;
private readonly InputAction m_Player_CancelHold; private readonly InputAction m_Player_CancelHold;
private readonly InputAction m_Player_Attack; private readonly InputAction m_Player_Attack;
private readonly InputAction m_Player_Roll;
public struct PlayerActions public struct PlayerActions
{ {
private @BlueWater m_Wrapper; private @BlueWater m_Wrapper;
@ -585,6 +618,7 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
public InputAction @SpawnInIsladnPlayer => m_Wrapper.m_Player_SpawnInIsladnPlayer; public InputAction @SpawnInIsladnPlayer => m_Wrapper.m_Player_SpawnInIsladnPlayer;
public InputAction @CancelHold => m_Wrapper.m_Player_CancelHold; public InputAction @CancelHold => m_Wrapper.m_Player_CancelHold;
public InputAction @Attack => m_Wrapper.m_Player_Attack; public InputAction @Attack => m_Wrapper.m_Player_Attack;
public InputAction @Roll => m_Wrapper.m_Player_Roll;
public InputActionMap Get() { return m_Wrapper.m_Player; } public InputActionMap Get() { return m_Wrapper.m_Player; }
public void Enable() { Get().Enable(); } public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); } public void Disable() { Get().Disable(); }
@ -630,6 +664,9 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
@Attack.started += instance.OnAttack; @Attack.started += instance.OnAttack;
@Attack.performed += instance.OnAttack; @Attack.performed += instance.OnAttack;
@Attack.canceled += instance.OnAttack; @Attack.canceled += instance.OnAttack;
@Roll.started += instance.OnRoll;
@Roll.performed += instance.OnRoll;
@Roll.canceled += instance.OnRoll;
} }
private void UnregisterCallbacks(IPlayerActions instance) private void UnregisterCallbacks(IPlayerActions instance)
@ -670,6 +707,9 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
@Attack.started -= instance.OnAttack; @Attack.started -= instance.OnAttack;
@Attack.performed -= instance.OnAttack; @Attack.performed -= instance.OnAttack;
@Attack.canceled -= instance.OnAttack; @Attack.canceled -= instance.OnAttack;
@Roll.started -= instance.OnRoll;
@Roll.performed -= instance.OnRoll;
@Roll.canceled -= instance.OnRoll;
} }
public void RemoveCallbacks(IPlayerActions instance) public void RemoveCallbacks(IPlayerActions instance)
@ -835,6 +875,7 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
void OnSpawnInIsladnPlayer(InputAction.CallbackContext context); void OnSpawnInIsladnPlayer(InputAction.CallbackContext context);
void OnCancelHold(InputAction.CallbackContext context); void OnCancelHold(InputAction.CallbackContext context);
void OnAttack(InputAction.CallbackContext context); void OnAttack(InputAction.CallbackContext context);
void OnRoll(InputAction.CallbackContext context);
} }
public interface ICameraActions public interface ICameraActions
{ {

View File

@ -112,6 +112,15 @@
"processors": "", "processors": "",
"interactions": "", "interactions": "",
"initialStateCheck": false "initialStateCheck": false
},
{
"name": "Roll",
"type": "Button",
"id": "c68960a5-036f-4304-8d05-25778470ecfd",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
} }
], ],
"bindings": [ "bindings": [
@ -290,6 +299,28 @@
"action": "Attack", "action": "Attack",
"isComposite": false, "isComposite": false,
"isPartOfComposite": false "isPartOfComposite": false
},
{
"name": "",
"id": "c5b5e8bc-aca9-40bb-8e57-6bb1349f08d0",
"path": "<Keyboard>/k",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Attack",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "5a134753-6868-4dec-9b0e-5839b48f7417",
"path": "<Keyboard>/space",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Roll",
"isComposite": false,
"isPartOfComposite": false
} }
] ]
}, },

View File

@ -9,8 +9,34 @@ namespace BlueWaterProject
[RequireComponent(typeof(PlayerInput))] [RequireComponent(typeof(PlayerInput))]
public class Player : BaseCharacter, IDamageable, IView public class Player : BaseCharacter, IDamageable, IView
{ {
protected PlayerInput playerInput;
protected Vector2 movementInput; protected Vector2 movementInput;
protected override void Awake()
{
base.Awake();
playerInput = GetComponent<PlayerInput>();
}
protected override void OnEnable()
{
base.OnEnable();
playerInput.actions.Enable();
playerInput.actions.FindAction("Move").performed += OnMove;
playerInput.actions.FindAction("Move").canceled += OnMove;
}
protected override void OnDisable()
{
base.OnDisable();
playerInput.actions.Disable();
playerInput.actions.FindAction("Move").performed -= OnMove;
playerInput.actions.FindAction("Move").canceled -= OnMove;
}
public virtual void TakeDamage(float attackerPower, float attackerShieldPenetrationRate = default, Vector3? attackPos = null) public virtual void TakeDamage(float attackerPower, float attackerShieldPenetrationRate = default, Vector3? attackPos = null)
{ {
throw new System.NotImplementedException(); throw new System.NotImplementedException();
@ -21,9 +47,9 @@ namespace BlueWaterProject
throw new NotImplementedException(); throw new NotImplementedException();
} }
public virtual void OnMove(InputValue value) // WASD public virtual void OnMove(InputAction.CallbackContext context) // WASD
{ {
movementInput = value.Get<Vector2>(); movementInput = context.ReadValue<Vector2>();
} }
#region Interfaces #region Interfaces
@ -36,7 +62,7 @@ namespace BlueWaterProject
[field: SerializeField] public Collider Target { get; set; } [field: SerializeField] public Collider Target { get; set; }
[field: SerializeField] public LayerMask TargetLayer { get; set; } [field: SerializeField] public LayerMask TargetLayer { get; set; }
private const int MAX_COLLIDERS = 30; protected const int MAX_COLLIDERS = 30;
public virtual void FindNearestTargetInRange(Vector3 centerPos, bool targetIsTrigger = true) public virtual void FindNearestTargetInRange(Vector3 centerPos, bool targetIsTrigger = true)
{ {

View File

@ -46,6 +46,7 @@ namespace BlueWaterProject
[field: SerializeField] public float Atk { get; private set; } = 10f; [field: SerializeField] public float Atk { get; private set; } = 10f;
[field: Tooltip("공격 속도(다음 공격 주기)\nAtkCooldown = 2f (2초마다 1번 공격)")] [field: Tooltip("공격 속도(다음 공격 주기)\nAtkCooldown = 2f (2초마다 1번 공격)")]
[field: OnValueChanged("SetAtkWaitCooldown")]
[field: SerializeField] public float AtkCooldown { get; private set; } = 1f; [field: SerializeField] public float AtkCooldown { get; private set; } = 1f;
[field: Tooltip("이동 제한 범위 설정")] [field: Tooltip("이동 제한 범위 설정")]
@ -84,18 +85,26 @@ namespace BlueWaterProject
[field: DisableIf("@true")] [field: DisableIf("@true")]
[field: SerializeField] public bool UseRigidbody { get; set; } [field: SerializeField] public bool UseRigidbody { get; set; }
[DisableIf("@true")] [DisableIf("@true")]
[SerializeField] private bool useMouseAttack;
[DisableIf("@true")]
[SerializeField] private bool isRolling;
[DisableIf("@true")]
[SerializeField] private bool beAttacked; [SerializeField] private bool beAttacked;
[DisableIf("@true")] [DisableIf("@true")]
[SerializeField] private bool isAttacking; [SerializeField] private bool isAttacking;
// Attack 테스트 // 테스트용 변수
[Title("공격 테스트")] [Title("테스트")]
public float attackAngle = 180f; public float attackAngle = 180f;
public float angleSpeed = 0.3f; public float angleSpeed = 0.3f;
public float rollDuration = 0.5f;
public float rollForce = 10f;
// 일반 변수 // 일반 변수
private bool usedNormalAttackCoroutine; private bool usedNormalAttackCoroutine;
private Vector3 previousDir;
private WaitForSeconds waitAtkCooldown; private WaitForSeconds waitAtkCooldown;
private Collider[] hitColliders;
// 컴포넌트 // 컴포넌트
public GameObject GameObject => gameObject; public GameObject GameObject => gameObject;
@ -107,7 +116,8 @@ namespace BlueWaterProject
private Transform unitRoot; private Transform unitRoot;
private Animator myAnimator; private Animator myAnimator;
private Transform trailRoot; private Transform trailRoot;
private ParticleSystem[] trailParticles; private ParticleSystem[] attackTrailParticles;
private ParticleSystem afterImageTrail;
private Canvas worldSpaceCanvas; private Canvas worldSpaceCanvas;
// Hash // Hash
@ -164,13 +174,6 @@ namespace BlueWaterProject
Gizmos.color = targetToDistance <= AtkRange ? Color.blue : Color.red; Gizmos.color = targetToDistance <= AtkRange ? Color.blue : Color.red;
Gizmos.DrawLine(myCenterPos, Target.bounds.center); Gizmos.DrawLine(myCenterPos, Target.bounds.center);
} }
Vector3 RotateVectorByAngle(Vector3 originalDirection, float angle)
{
Quaternion rotationQuaternion = Quaternion.Euler(0f, angle, 0f); // y축을 중심으로 회전
Vector3 rotatedDirection = rotationQuaternion * originalDirection;
return rotatedDirection;
}
protected override void Awake() protected override void Awake()
{ {
@ -194,7 +197,7 @@ namespace BlueWaterProject
print("myAnimator를 찾을 수 없습니다."); print("myAnimator를 찾을 수 없습니다.");
} }
} }
trailRoot = transform.Find("TrailRoot"); trailRoot = transform.Find("TrailRoot");
if (trailRoot == null) if (trailRoot == null)
{ {
@ -202,7 +205,25 @@ namespace BlueWaterProject
} }
else else
{ {
trailParticles = trailRoot.GetComponentsInChildren<ParticleSystem>(); var attackTrailRoot = trailRoot.Find("AttackTrailRoot");
if (attackTrailRoot == null)
{
print("AttackTrailRoot오브젝트를 찾을 수 없습니다.");
}
else
{
attackTrailParticles = attackTrailRoot.GetComponentsInChildren<ParticleSystem>();
}
var afterImageTrailRoot = trailRoot.Find("AfterImageTrailRoot");
if (afterImageTrailRoot == null)
{
print("AfterImageTrailRoot오브젝트를 찾을 수 없습니다.");
}
else
{
afterImageTrail = afterImageTrailRoot.GetComponentInChildren<ParticleSystem>();
}
} }
worldSpaceCanvas = GameObject.Find("WorldSpaceCanvas")?.GetComponent<Canvas>(); worldSpaceCanvas = GameObject.Find("WorldSpaceCanvas")?.GetComponent<Canvas>();
@ -224,7 +245,8 @@ namespace BlueWaterProject
protected override void Start() protected override void Start()
{ {
base.Start(); base.Start();
hitColliders = new Collider[MAX_COLLIDERS];
TargetLayer = LayerMask.GetMask("Enemy"); TargetLayer = LayerMask.GetMask("Enemy");
waitAtkCooldown = new WaitForSeconds(AtkCooldown); waitAtkCooldown = new WaitForSeconds(AtkCooldown);
@ -241,138 +263,50 @@ namespace BlueWaterProject
} }
SetCurrentHp(MaxHp); SetCurrentHp(MaxHp);
} }
protected override void OnEnable()
{
base.OnEnable();
playerInput.actions.FindAction("Attack").performed += OnAttack;
playerInput.actions.FindAction("Roll").performed += OnRoll;
}
protected override void OnDisable()
{
base.OnDisable();
playerInput.actions.FindAction("Attack").performed -= OnAttack;
playerInput.actions.FindAction("Roll").performed -= OnRoll;
}
protected override void Update() protected override void Update()
{ {
switch (useHpSlider) HpSliderUpdate();
{
case true when CurrentHp > 0 && CurrentHp < MaxHp:
{
if (!hpSlider.gameObject.activeSelf)
{
hpSlider.gameObject.SetActive(true);
}
var localOffset = unitRoot.TransformPoint(hpSliderOffset);
hpSlider.transform.position = localOffset;
break;
}
case true when CurrentHp <= 0 || CurrentHp >= MaxHp:
{
if (hpSlider.gameObject.activeSelf)
{
hpSlider.gameObject.SetActive(false);
}
break;
}
}
if (CurrentHp <= 0) return; if (CurrentHp <= 0) return;
// 움직이는 경우
if (movementInput.x != 0 || movementInput.y != 0)
{
// Rigidbody 사용
if (!UseRigidbody)
{
UseRigidbodyMovement();
}
if (!beAttacked) MoveUpdate();
{ FlipCharacterUpdate();
myAnimator.SetFloat(RunStateHash, 0.5f);
}
}
// 멈춰있는 경우
else
{
if (UseRigidbody)
{
UseRigidbody = false;
Rb.velocity = Vector3.zero;
}
myAnimator.SetFloat(RunStateHash, 0f);
// // NavMeshAgent 사용
// if (UseRigidbody)
// {
// UseAgentMovement();
// }
//
// if (Agent.velocity.x != 0 || Agent.velocity.z != 0)
// {
// myAnimator.SetFloat(RunStateHash, 0.5f);
// }
// else if (!beAttacked)
// {
// myAnimator.SetFloat(RunStateHash, 0f);
// }
}
var localScale = transform.localScale;
if (UseRigidbody)
{
localScale.x = Rb.velocity.x switch
{
> 0 => Mathf.Abs(localScale.x),
< 0 => -Mathf.Abs(localScale.x),
_ => localScale.x
};
}
else
{
if (Agent.velocity.x != 0)
{
localScale.x = Agent.velocity.x switch
{
> 0 => Mathf.Abs(localScale.x),
< 0 => -Mathf.Abs(localScale.x),
_ => localScale.x
};
}
else
{
if (Target)
{
var targetToDistanceX = Target.bounds.center.x - MyCollider.bounds.center.x;
localScale.x = targetToDistanceX switch
{
> 0 => Mathf.Abs(localScale.x),
< 0 => -Mathf.Abs(localScale.x),
_ => localScale.x
};
}
}
}
transform.localScale = localScale;
var trailRootLocalScale = trailRoot.localScale;
trailRootLocalScale.x = localScale.x switch
{
> 0 => Mathf.Abs(trailRootLocalScale.x),
< 0 => -Mathf.Abs(trailRootLocalScale.x),
_ => localScale.x
};
trailRoot.localScale = trailRootLocalScale;
} }
protected override void FixedUpdate() protected override void FixedUpdate()
{ {
if (CurrentHp <= 0) return; if (CurrentHp <= 0) return;
if (UseRigidbody) if (UseRigidbody && !isRolling)
{ {
var localMovement = new Vector3(movementInput.x, 0, movementInput.y); var localMovement = new Vector3(movementInput.x, 0, movementInput.y);
var worldDirection = transform.TransformDirection(localMovement); var worldDirection = transform.TransformDirection(localMovement).normalized;
var movement = worldDirection * MoveSpd; var movement = worldDirection * MoveSpd;
Rb.velocity = new Vector3(movement.x, 0, movement.z); Rb.velocity = new Vector3(movement.x, 0, movement.z);
}
DefensePos = transform.position;
foreach (var crewmate in GameManager.Inst.CurrentCrewmateList) DefensePos = transform.position;
{ foreach (var crewmate in GameManager.Inst.CurrentCrewmateList)
crewmate.DefensePos = DefensePos; {
} crewmate.DefensePos = DefensePos;
} }
} }
@ -383,6 +317,8 @@ namespace BlueWaterProject
// IDamageable // IDamageable
public override void TakeDamage(float attackerPower, float attackerShieldPenetrationRate = default, Vector3? attackPos = null) public override void TakeDamage(float attackerPower, float attackerShieldPenetrationRate = default, Vector3? attackPos = null)
{ {
if (isRolling) return;
IsCombated = true; IsCombated = true;
if (!Target) if (!Target)
@ -417,8 +353,7 @@ namespace BlueWaterProject
Rb.isKinematic = true; Rb.isKinematic = true;
} }
Agent.enabled = false; Agent.enabled = false;
var overlayCanvas = GameObject.Find("OverlayCanvas");
switch (GameManager.Inst.IslandPlayerMode) switch (GameManager.Inst.IslandPlayerMode)
{ {
@ -426,8 +361,7 @@ namespace BlueWaterProject
print("IslandPlayerMode == none error."); print("IslandPlayerMode == none error.");
break; break;
case GlobalValue.InIslandPlayerMode.ONLY_PLAYER: case GlobalValue.InIslandPlayerMode.ONLY_PLAYER:
// 게임 종료 GameOver();
overlayCanvas.transform.Find("RestartPopUp").gameObject.SetActive(true);
return; return;
case GlobalValue.InIslandPlayerMode.CREWMATE: case GlobalValue.InIslandPlayerMode.CREWMATE:
foreach (var crewmate in GameManager.Inst.CurrentCrewmateList) foreach (var crewmate in GameManager.Inst.CurrentCrewmateList)
@ -437,8 +371,7 @@ namespace BlueWaterProject
GameManager.Inst.SetCurrentInIslandPlayer(crewmate); GameManager.Inst.SetCurrentInIslandPlayer(crewmate);
return; return;
} }
// 게임 종료 GameOver();
overlayCanvas.transform.Find("RestartPopUp").gameObject.SetActive(true);
return; return;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
@ -461,17 +394,26 @@ namespace BlueWaterProject
// var iDamageable = hit.transform.GetComponent<IDamageable>(); // var iDamageable = hit.transform.GetComponent<IDamageable>();
// iDamageable.TakeDamage(Atk); // iDamageable.TakeDamage(Atk);
var mousePos = Mouse.current.position.ReadValue(); Vector3 attackDirection;
var ray = Camera.main.ScreenPointToRay(mousePos); if (useMouseAttack)
{
if (!Physics.Raycast(ray, out var hit)) return; var mousePos = Mouse.current.position.ReadValue();
var ray = Camera.main.ScreenPointToRay(mousePos);
var mouseWorldPos = hit.point;
mouseWorldPos.y = MyCollider.bounds.center.y;
var attackDirection = (mouseWorldPos - transform.position).normalized;
var hitColliders = new Collider[20];
var size = Physics.OverlapSphereNonAlloc(transform.position, AtkRange, hitColliders, TargetLayer); if (!Physics.Raycast(ray, out var hit)) return;
var hitPos = hit.point;
hitPos.y = MyCollider.bounds.center.y;
attackDirection = (hitPos - MyCollider.bounds.center).normalized;
}
else
{
attackDirection = previousDir;
}
Array.Clear(hitColliders, 0, MAX_COLLIDERS);
var size = Physics.OverlapSphereNonAlloc(MyCollider.bounds.center, AtkRange, hitColliders, TargetLayer);
for (var i = 0; i < size; i++) for (var i = 0; i < size; i++)
{ {
@ -488,22 +430,48 @@ namespace BlueWaterProject
private IEnumerator DrawAttackTrail() private IEnumerator DrawAttackTrail()
{ {
var mousePos = Mouse.current.position.ReadValue(); Vector3 attackDirection;
var ray = Camera.main.ScreenPointToRay(mousePos); if (useMouseAttack)
{
var mousePos = Mouse.current.position.ReadValue();
var ray = Camera.main.ScreenPointToRay(mousePos);
if (!Physics.Raycast(ray, out var hit)) yield break; if (!Physics.Raycast(ray, out var hit)) yield break;
var hitPos = hit.point;
hitPos.y = MyCollider.bounds.center.y;
attackDirection = (hitPos - MyCollider.bounds.center).normalized;
}
else
{
attackDirection = previousDir;
}
var mouseWorldPos = hit.point; var localScale = transform.localScale;
mouseWorldPos.y = transform.position.y; localScale.x = attackDirection.x switch
var directionToMouse = (mouseWorldPos - transform.position).normalized; {
> 0.01f => Mathf.Abs(localScale.x),
< -0.01f => -Mathf.Abs(localScale.x),
_ => localScale.x
};
transform.localScale = localScale;
var trailRootLocalScale = trailRoot.localScale;
trailRootLocalScale.x = localScale.x switch
{
> 0.01f => Mathf.Abs(trailRootLocalScale.x),
< -0.01f => -Mathf.Abs(trailRootLocalScale.x),
_ => localScale.x
};
trailRoot.localScale = trailRootLocalScale;
var leftRotation = Quaternion.Euler(0, -attackAngle * 0.5f, 0); var leftRotation = Quaternion.Euler(0, -attackAngle * 0.5f, 0);
var rightRotation = Quaternion.Euler(0, attackAngle * 0.5f, 0); var rightRotation = Quaternion.Euler(0, attackAngle * 0.5f, 0);
trailRoot.rotation = Quaternion.LookRotation(directionToMouse) * leftRotation; trailRoot.rotation = Quaternion.LookRotation(attackDirection) * leftRotation;
foreach (var trail in trailParticles) foreach (var trail in attackTrailParticles)
{ {
trail.Clear();
trail.Play(); trail.Play();
} }
@ -512,8 +480,8 @@ namespace BlueWaterProject
{ {
var t = time / angleSpeed; var t = time / angleSpeed;
trailRoot.rotation = Quaternion.Slerp( trailRoot.rotation = Quaternion.Slerp(
Quaternion.LookRotation(directionToMouse) * leftRotation, Quaternion.LookRotation(attackDirection) * leftRotation,
Quaternion.LookRotation(directionToMouse) * rightRotation, Quaternion.LookRotation(attackDirection) * rightRotation,
t t
); );
@ -521,10 +489,12 @@ namespace BlueWaterProject
yield return null; yield return null;
} }
foreach (var trail in trailParticles) foreach (var trail in attackTrailParticles)
{ {
trail.Stop(); trail.Stop();
} }
useMouseAttack = false;
} }
public void SetIsAttacking(int boolValue) => isAttacking = boolValue == 1; public void SetIsAttacking(int boolValue) => isAttacking = boolValue == 1;
@ -547,7 +517,7 @@ namespace BlueWaterProject
return !defensePosInRange; return !defensePosInRange;
} }
public override void MoveTarget(Vector3 targetPos, float speed, float stopDistance = Single.MaxValue) public override void MoveTarget(Vector3 targetPos, float speed, float stopDistance = float.MaxValue)
{ {
if (Vector3.Distance(Agent.destination, targetPos) < 0.1f) return; if (Vector3.Distance(Agent.destination, targetPos) < 0.1f) return;
@ -560,8 +530,6 @@ namespace BlueWaterProject
// INormalAttack // INormalAttack
public void NormalAttack() public void NormalAttack()
{ {
if (CurrentHp <= 0f || usedNormalAttackCoroutine) return;
StartCoroutine(nameof(NormalAttackCoroutine)); StartCoroutine(nameof(NormalAttackCoroutine));
StartCoroutine(nameof(DrawAttackTrail)); StartCoroutine(nameof(DrawAttackTrail));
} }
@ -573,18 +541,37 @@ namespace BlueWaterProject
#region Player input system #region Player input system
public override void OnMove(InputValue value) public override void OnMove(InputAction.CallbackContext context)
{ {
if (CurrentHp <= 0) return; if (CurrentHp <= 0) return;
base.OnMove(value); base.OnMove(context);
} }
public void OnAttack() public void OnAttack(InputAction.CallbackContext context)
{ {
if (CurrentHp <= 0f || isRolling || usedNormalAttackCoroutine) return;
var control = context.control;
if (control.name.Equals("leftButton"))
{
useMouseAttack = true;
}
else if (control.name.Equals("k"))
{
useMouseAttack = false;
}
NormalAttack(); NormalAttack();
} }
public void OnRoll(InputAction.CallbackContext context)
{
if (isRolling) return;
StartCoroutine(nameof(Roll));
}
#endregion #endregion
#region Custom methods #region Custom methods
@ -611,6 +598,157 @@ namespace BlueWaterProject
usedNormalAttackCoroutine = false; usedNormalAttackCoroutine = false;
} }
private void HpSliderUpdate()
{
switch (useHpSlider)
{
case true when CurrentHp > 0 && CurrentHp < MaxHp:
{
if (!hpSlider.gameObject.activeSelf)
{
hpSlider.gameObject.SetActive(true);
}
var localOffset = unitRoot.TransformPoint(hpSliderOffset);
hpSlider.transform.position = localOffset;
break;
}
case true when CurrentHp <= 0 || CurrentHp >= MaxHp:
{
if (hpSlider.gameObject.activeSelf)
{
hpSlider.gameObject.SetActive(false);
}
break;
}
}
}
private void MoveUpdate()
{
// 움직이는 경우
if (movementInput != Vector2.zero)
{
// Rigidbody 사용
if (!UseRigidbody)
{
UseRigidbodyMovement();
}
if (!beAttacked)
{
myAnimator.SetFloat(RunStateHash, 0.5f);
}
previousDir = Rb.velocity.normalized;
}
// 멈춰있는 경우
else
{
if (UseRigidbody)
{
UseRigidbody = false;
Rb.velocity = Vector3.zero;
}
myAnimator.SetFloat(RunStateHash, 0f);
// // NavMeshAgent 사용
// if (UseRigidbody)
// {
// UseAgentMovement();
// }
//
// if (Agent.velocity.x != 0 || Agent.velocity.z != 0)
// {
// myAnimator.SetFloat(RunStateHash, 0.5f);
// }
// else if (!beAttacked)
// {
// myAnimator.SetFloat(RunStateHash, 0f);
// }
}
}
private void FlipCharacterUpdate()
{
if (useMouseAttack) return;
var localScale = transform.localScale;
var xVelocity = 0f;
if (UseRigidbody)
{
xVelocity = Rb.velocity.x;
}
else
{
if (Agent.velocity.x != 0)
{
xVelocity = Agent.velocity.x;
}
else
{
if (Target)
{
xVelocity = Target.bounds.center.x - MyCollider.bounds.center.x;
}
}
}
localScale.x = xVelocity switch
{
> 0.01f => Mathf.Abs(localScale.x),
< -0.01f => -Mathf.Abs(localScale.x),
_ => localScale.x
};
transform.localScale = localScale;
var trailRootLocalScale = trailRoot.localScale;
trailRootLocalScale.x = localScale.x switch
{
> 0.01f => Mathf.Abs(trailRootLocalScale.x),
< -0.01f => -Mathf.Abs(trailRootLocalScale.x),
_ => localScale.x
};
trailRoot.localScale = trailRootLocalScale;
}
private IEnumerator Roll()
{
isRolling = true;
var time = 0f;
afterImageTrail.Clear();
afterImageTrail.Play();
var worldDirection = transform.TransformDirection(previousDir);
var movement = worldDirection * (MoveSpd * rollForce);
while (time < rollDuration)
{
Rb.velocity = new Vector3(movement.x, 0, movement.z);
time += Time.deltaTime;
yield return null;
}
afterImageTrail.Stop();
isRolling = false;
if (movementInput == Vector2.zero)
{
Rb.velocity = Vector3.zero;
myAnimator.SetFloat(RunStateHash, 0f);
}
}
private void GameOver()
{
var overlayCanvas = GameObject.Find("OverlayCanvas");
overlayCanvas.transform.Find("RestartPopUp").gameObject.SetActive(true);
}
private void UseRigidbodyMovement() private void UseRigidbodyMovement()
{ {
UseRigidbody = true; UseRigidbody = true;
@ -650,6 +788,7 @@ namespace BlueWaterProject
} }
private void SetAgentSpeed(float value) => Agent.speed = value; private void SetAgentSpeed(float value) => Agent.speed = value;
private void SetAtkWaitCooldown() => waitAtkCooldown = new WaitForSeconds(AtkCooldown);
#endregion #endregion
} }