From ad2e4a7f6e53eafc7318d7747681ac94db1e7065 Mon Sep 17 00:00:00 2001 From: fiore Date: Fri, 18 Apr 2025 13:10:28 +0900 Subject: [PATCH] =?UTF-8?q?DEG-28=20DEG-33=20[feat]=20=EB=AA=AC=EC=8A=A4?= =?UTF-8?q?=ED=84=B0=20=EA=B3=B5=EA=B2=A9=20=EC=95=A1=EC=85=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Editor.meta | 3 + Assets/Editor/EnemyControllerEditor.cs | 82 +++++++++++++ Assets/Editor/EnemyControllerEditor.cs.meta | 3 + Assets/JYY/Animation/Attack01.anim | 3 + Assets/JYY/Animation/Attack01.anim.meta | 8 ++ Assets/JYY/Animation/Attack02.anim | 3 + Assets/JYY/Animation/Attack02.anim.meta | 8 ++ Assets/JYY/Animation/Defend.anim | 3 + Assets/JYY/Animation/Defend.anim.meta | 8 ++ Assets/JYY/Animation/Die.anim | 3 + Assets/JYY/Animation/Die.anim.meta | 8 ++ Assets/JYY/Animation/DieRecover.anim | 3 + Assets/JYY/Animation/DieRecover.anim.meta | 8 ++ Assets/JYY/Animation/Dizzy.anim | 3 + Assets/JYY/Animation/Dizzy.anim.meta | 8 ++ Assets/JYY/Animation/GetHit.anim | 3 + Assets/JYY/Animation/GetHit.anim.meta | 8 ++ Assets/JYY/Animation/Idle_Battle.anim | 3 + Assets/JYY/Animation/Idle_Battle.anim.meta | 8 ++ Assets/JYY/Animation/RunForwardBattle.anim | 3 + .../JYY/Animation/RunForwardBattle.anim.meta | 8 ++ Assets/JYY/Animation/WalkForwardBattle.anim | 3 + .../JYY/Animation/WalkForwardBattle.anim.meta | 8 ++ Assets/JYY/Animator/PldDogControl.controller | 4 +- Assets/JYY/Scenes/MonsterTest.meta | 8 ++ Assets/JYY/Scenes/MonsterTest.unity | 4 +- .../Scenes/MonsterTest/NavMesh-Plane.asset | Bin 0 -> 10020 bytes .../MonsterTest/NavMesh-Plane.asset.meta | 8 ++ .../Character/Enemy/EnemyController.cs | 28 +++-- .../Enemy/EnemyState/EnemyStateAttack.cs | 26 ++++- .../Enemy/EnemyState/EnemyStateTrace.cs | 108 +++++++++++++++++- .../Character/Enemy/PldDogController.cs | 12 -- .../DogKnight/Animations/Attack01.anim.meta | 6 +- .../DogKnight/Animations/Attack02.anim.meta | 6 +- .../DogKnight/Animations/Defend.anim.meta | 6 +- .../DogKnight/Animations/Die.anim.meta | 6 +- .../DogKnight/Animations/DieRecover.anim | 2 +- .../DogKnight/Animations/DieRecover.anim.meta | 6 +- .../DogKnight/Animations/Dizzy.anim.meta | 6 +- .../DogKnight/Animations/GetHit.anim.meta | 6 +- .../Animations/Idle_Battle.anim.meta | 6 +- .../Animations/RunForwardBattle.anim | 2 +- .../Animations/RunForwardBattle.anim.meta | 6 +- .../Animations/WalkForwardBattle.anim.meta | 6 +- Packages/manifest.json | 1 + Packages/packages-lock.json | 9 ++ ProjectSettings/NavMeshAreas.asset | 8 +- ProjectSettings/TagManager.asset | 5 +- 48 files changed, 417 insertions(+), 66 deletions(-) create mode 100644 Assets/Editor.meta create mode 100644 Assets/Editor/EnemyControllerEditor.cs create mode 100644 Assets/Editor/EnemyControllerEditor.cs.meta create mode 100644 Assets/JYY/Animation/Attack01.anim create mode 100644 Assets/JYY/Animation/Attack01.anim.meta create mode 100644 Assets/JYY/Animation/Attack02.anim create mode 100644 Assets/JYY/Animation/Attack02.anim.meta create mode 100644 Assets/JYY/Animation/Defend.anim create mode 100644 Assets/JYY/Animation/Defend.anim.meta create mode 100644 Assets/JYY/Animation/Die.anim create mode 100644 Assets/JYY/Animation/Die.anim.meta create mode 100644 Assets/JYY/Animation/DieRecover.anim create mode 100644 Assets/JYY/Animation/DieRecover.anim.meta create mode 100644 Assets/JYY/Animation/Dizzy.anim create mode 100644 Assets/JYY/Animation/Dizzy.anim.meta create mode 100644 Assets/JYY/Animation/GetHit.anim create mode 100644 Assets/JYY/Animation/GetHit.anim.meta create mode 100644 Assets/JYY/Animation/Idle_Battle.anim create mode 100644 Assets/JYY/Animation/Idle_Battle.anim.meta create mode 100644 Assets/JYY/Animation/RunForwardBattle.anim create mode 100644 Assets/JYY/Animation/RunForwardBattle.anim.meta create mode 100644 Assets/JYY/Animation/WalkForwardBattle.anim create mode 100644 Assets/JYY/Animation/WalkForwardBattle.anim.meta create mode 100644 Assets/JYY/Scenes/MonsterTest.meta create mode 100644 Assets/JYY/Scenes/MonsterTest/NavMesh-Plane.asset create mode 100644 Assets/JYY/Scenes/MonsterTest/NavMesh-Plane.asset.meta diff --git a/Assets/Editor.meta b/Assets/Editor.meta new file mode 100644 index 00000000..7080a20f --- /dev/null +++ b/Assets/Editor.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 612dfb3f3c0e45e3aaa9d5def5189516 +timeCreated: 1744852718 \ No newline at end of file diff --git a/Assets/Editor/EnemyControllerEditor.cs b/Assets/Editor/EnemyControllerEditor.cs new file mode 100644 index 00000000..a541a08c --- /dev/null +++ b/Assets/Editor/EnemyControllerEditor.cs @@ -0,0 +1,82 @@ +using UnityEditor; +using UnityEngine; + +[CustomEditor(typeof(PldDogController))] +public class EnemyControllerEditor : Editor +{ + public override void OnInspectorGUI() + { + // 기본 인스펙터를 그리기 + base.OnInspectorGUI(); + + // 타겟 컴포넌트 참조 가져오기 + EnemyController enemyController = (EnemyController)target; + + // 여백 추가 + EditorGUILayout.Space(); + EditorGUILayout.LabelField("상태 디버그 정보", EditorStyles.boldLabel); + + EditorGUILayout.BeginVertical(EditorStyles.helpBox); + + // 상태별 색상 지정 + switch (enemyController.CurrentState) + { + case EnemyState.Idle: + GUI.backgroundColor = new Color(0, 0, 1, 1f); + break; + case EnemyState.Trace: + GUI.backgroundColor = new Color(1, 0, 1, 1f); + break; + case EnemyState.Attack: + GUI.backgroundColor = new Color(1, 1, 0, 1f); + break; + case EnemyState.Move: + GUI.backgroundColor = new Color(0, 1, 1, 1f); + break; + case EnemyState.GetHit: + GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 1f); + break; + case EnemyState.Dead: + GUI.backgroundColor = new Color(1, 0, 0, 1f); + break; + } + + EditorGUILayout.BeginVertical(EditorStyles.helpBox); + EditorGUILayout.LabelField("현재 상태", enemyController.CurrentState.ToString(), + EditorStyles.boldLabel); + EditorGUILayout.EndVertical(); + + EditorGUILayout.EndVertical(); + + EditorGUILayout.Space(); + EditorGUILayout.LabelField("상태 변경", EditorStyles.boldLabel); + + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("Idle")) enemyController.SetState(EnemyState.Idle); + if (GUILayout.Button("Trace")) enemyController.SetState(EnemyState.Trace); + if (GUILayout.Button("Attack")) enemyController.SetState(EnemyState.Attack); + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("Move")) enemyController.SetState(EnemyState.Move); + if (GUILayout.Button("GetHit")) enemyController.SetState(EnemyState.GetHit); + if (GUILayout.Button("Dead")) enemyController.SetState(EnemyState.Dead); + EditorGUILayout.EndHorizontal(); + } + + private void OnEnable() + { + EditorApplication.update += OnEditorUpdate; + } + + private void OnDisable() + { + EditorApplication.update -= OnEditorUpdate; + } + + private void OnEditorUpdate() + { + if (target != null) + Repaint(); + } +} \ No newline at end of file diff --git a/Assets/Editor/EnemyControllerEditor.cs.meta b/Assets/Editor/EnemyControllerEditor.cs.meta new file mode 100644 index 00000000..bbd43f56 --- /dev/null +++ b/Assets/Editor/EnemyControllerEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9e73fc154fc447fea93336f02b6df5ea +timeCreated: 1744852745 \ No newline at end of file diff --git a/Assets/JYY/Animation/Attack01.anim b/Assets/JYY/Animation/Attack01.anim new file mode 100644 index 00000000..5d662b91 --- /dev/null +++ b/Assets/JYY/Animation/Attack01.anim @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f04cea52f30d6a8688be613ca2f24015a6df84f6cf0cfaab6fb91eb1eb6e90a +size 603903 diff --git a/Assets/JYY/Animation/Attack01.anim.meta b/Assets/JYY/Animation/Attack01.anim.meta new file mode 100644 index 00000000..f8e8feff --- /dev/null +++ b/Assets/JYY/Animation/Attack01.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6019f1b4a095b0b4396f5561a51fee89 +timeCreated: 1544605028 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/JYY/Animation/Attack02.anim b/Assets/JYY/Animation/Attack02.anim new file mode 100644 index 00000000..c2dda702 --- /dev/null +++ b/Assets/JYY/Animation/Attack02.anim @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a63148e99ba21c92b2213dcd7a7f95f214a7392e7f715f4c57466afe01f07e0 +size 552838 diff --git a/Assets/JYY/Animation/Attack02.anim.meta b/Assets/JYY/Animation/Attack02.anim.meta new file mode 100644 index 00000000..6d2fbfcc --- /dev/null +++ b/Assets/JYY/Animation/Attack02.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eccbae3cfc77ad245ade46e143aa3200 +timeCreated: 1544605040 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/JYY/Animation/Defend.anim b/Assets/JYY/Animation/Defend.anim new file mode 100644 index 00000000..1c01da17 --- /dev/null +++ b/Assets/JYY/Animation/Defend.anim @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5adb42354f1acb2004091b9044997e01fc04f52f8a89e1f4468ee2469f67afde +size 297232 diff --git a/Assets/JYY/Animation/Defend.anim.meta b/Assets/JYY/Animation/Defend.anim.meta new file mode 100644 index 00000000..a1310b87 --- /dev/null +++ b/Assets/JYY/Animation/Defend.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cf357b5409b4ad54a82c45d7684564e1 +timeCreated: 1544607741 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/JYY/Animation/Die.anim b/Assets/JYY/Animation/Die.anim new file mode 100644 index 00000000..d69a9375 --- /dev/null +++ b/Assets/JYY/Animation/Die.anim @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95819368b936158e91796f7adaa2f99dd7e860ddf60edb574af6764586905a68 +size 675813 diff --git a/Assets/JYY/Animation/Die.anim.meta b/Assets/JYY/Animation/Die.anim.meta new file mode 100644 index 00000000..3ed5768a --- /dev/null +++ b/Assets/JYY/Animation/Die.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5d190d8211c88a64281f7b90c69f3eb3 +timeCreated: 1544605073 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/JYY/Animation/DieRecover.anim b/Assets/JYY/Animation/DieRecover.anim new file mode 100644 index 00000000..d8e064df --- /dev/null +++ b/Assets/JYY/Animation/DieRecover.anim @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:460540d5faabb3b676215b186bd9ee6fad7a50837c092ed84805169177fa1d83 +size 606894 diff --git a/Assets/JYY/Animation/DieRecover.anim.meta b/Assets/JYY/Animation/DieRecover.anim.meta new file mode 100644 index 00000000..1e729a3b --- /dev/null +++ b/Assets/JYY/Animation/DieRecover.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4a3671dbe6670524b8b6d9ad3664c179 +timeCreated: 1544607752 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/JYY/Animation/Dizzy.anim b/Assets/JYY/Animation/Dizzy.anim new file mode 100644 index 00000000..77a333f2 --- /dev/null +++ b/Assets/JYY/Animation/Dizzy.anim @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c7659f61876ad02dbb14d41299476a055663c131caa2f011e2e398db9d6d4bc +size 435820 diff --git a/Assets/JYY/Animation/Dizzy.anim.meta b/Assets/JYY/Animation/Dizzy.anim.meta new file mode 100644 index 00000000..b756a13d --- /dev/null +++ b/Assets/JYY/Animation/Dizzy.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 30d4fe7af77240a44b9354aaed8e5beb +timeCreated: 1544607757 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/JYY/Animation/GetHit.anim b/Assets/JYY/Animation/GetHit.anim new file mode 100644 index 00000000..4682dbdd --- /dev/null +++ b/Assets/JYY/Animation/GetHit.anim @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:388ecaff4209c6d27a477813922854699044394426202205616b5d88931232ab +size 520908 diff --git a/Assets/JYY/Animation/GetHit.anim.meta b/Assets/JYY/Animation/GetHit.anim.meta new file mode 100644 index 00000000..22ca0541 --- /dev/null +++ b/Assets/JYY/Animation/GetHit.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1588532e68f51a040bda71c68cfab177 +timeCreated: 1544605085 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/JYY/Animation/Idle_Battle.anim b/Assets/JYY/Animation/Idle_Battle.anim new file mode 100644 index 00000000..a63c7f98 --- /dev/null +++ b/Assets/JYY/Animation/Idle_Battle.anim @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f232d525015ed6e060e35367651d807b853f883889cd9e9f9fb0dcd1ffd3a394 +size 313903 diff --git a/Assets/JYY/Animation/Idle_Battle.anim.meta b/Assets/JYY/Animation/Idle_Battle.anim.meta new file mode 100644 index 00000000..ed48298b --- /dev/null +++ b/Assets/JYY/Animation/Idle_Battle.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b79ff7bb68348be479d3db6b7fe8a569 +timeCreated: 1544605090 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/JYY/Animation/RunForwardBattle.anim b/Assets/JYY/Animation/RunForwardBattle.anim new file mode 100644 index 00000000..bf68a90e --- /dev/null +++ b/Assets/JYY/Animation/RunForwardBattle.anim @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:571e16dde03ce0f7c5be77b1db916e8ac2adf08041270dab3452274b18accf48 +size 502807 diff --git a/Assets/JYY/Animation/RunForwardBattle.anim.meta b/Assets/JYY/Animation/RunForwardBattle.anim.meta new file mode 100644 index 00000000..0fca8d27 --- /dev/null +++ b/Assets/JYY/Animation/RunForwardBattle.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9f0e03164414016409d28995a128ba98 +timeCreated: 1544605137 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/JYY/Animation/WalkForwardBattle.anim b/Assets/JYY/Animation/WalkForwardBattle.anim new file mode 100644 index 00000000..ca732b9b --- /dev/null +++ b/Assets/JYY/Animation/WalkForwardBattle.anim @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65b4e832f19d66d82c17374044367afba4b7c0ffb70b092634266d8f063c41ac +size 433379 diff --git a/Assets/JYY/Animation/WalkForwardBattle.anim.meta b/Assets/JYY/Animation/WalkForwardBattle.anim.meta new file mode 100644 index 00000000..80e93aa1 --- /dev/null +++ b/Assets/JYY/Animation/WalkForwardBattle.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f0c8c1d913b359a428b42d53947d3e93 +timeCreated: 1544607284 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/JYY/Animator/PldDogControl.controller b/Assets/JYY/Animator/PldDogControl.controller index d7a7001a..924b40f1 100644 --- a/Assets/JYY/Animator/PldDogControl.controller +++ b/Assets/JYY/Animator/PldDogControl.controller @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5ae32e910b172b4f7b04fbf91607ef7d871adec9ee0233990fd3b38d3be5a807 -size 10132 +oid sha256:302f67e12e0abc61d39c9173fbe83f6d3acfd3a5efacf45923fc36c4962cae34 +size 13077 diff --git a/Assets/JYY/Scenes/MonsterTest.meta b/Assets/JYY/Scenes/MonsterTest.meta new file mode 100644 index 00000000..43e05aab --- /dev/null +++ b/Assets/JYY/Scenes/MonsterTest.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f736a70ba6c488a48b743638353258e9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/JYY/Scenes/MonsterTest.unity b/Assets/JYY/Scenes/MonsterTest.unity index 6b890b52..92364e75 100644 --- a/Assets/JYY/Scenes/MonsterTest.unity +++ b/Assets/JYY/Scenes/MonsterTest.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f8245853d24341e4dd4aca4c679c085f651439fed1342163e04143f6b274425 -size 90314 +oid sha256:f53e08854b36e3c0ebe9a5efbafa9f4c1ceb557ad34f4bc2ef099519af06757f +size 95972 diff --git a/Assets/JYY/Scenes/MonsterTest/NavMesh-Plane.asset b/Assets/JYY/Scenes/MonsterTest/NavMesh-Plane.asset new file mode 100644 index 0000000000000000000000000000000000000000..afe2d7047253e0595e4c2cb1fb58a9cefb3dda00 GIT binary patch literal 10020 zcmcJUeQ=aV9mn^QOQ_UBuoX%x7%dfwgy!xj^abc8Bs9D1PU!JRNJvll^3ZMM@NB9JH`x^KS)(9YSGHjKZup-bdb?Xr)vCt_vLP%du|ij zDLeD*v%8<&{q1*uyZdY|jHScqbc&7np-4}hAl_rnDdsQr`=rd0cUwwT(kq6gz1;o=_l2WmTy%F+Kw zdXKUxk|EoE5tWbXQ53eE_D6wdFy~*PJnW{~u(NknoB!fC%W)jE#yNw>KBNf2A zY3)}@KAAu+UN1S$xm^4~$)^~2yW}MXzFP9B2EJMH+YS6#$xCx^oZp8e_vPT-#E(ht z&%x2YSMq>?pOPGBefIpI{huYjBL~O#>4N0bb8xi3EIEDWT>W29AFUF4s0zCi+@?qd zoPRi90+QcF!SP30phq@EOPMz$Nj8^_$X#mEP{s>IPPbQso2TAjK*yLjQYp^sins`KCwSuC64`3 z2X0d&L-zfnp2~}Q6h)uT{jmf*gE{Y`zOg^he*?Iksi5v3f06c=y14WHfxC=ze>(3U z%fK_;ll?+=Ufw@2zhC9NI9v(xv>Mk*gn--F) zznj{t`DvlzB33M^un(^0$1-p=Kdmk<>|c{F?62Eyle{l~lrdlFo+fP#QVD?i6uI#UN@nQUY^OJq7)HR$_Bm?#* z?g!H(UrXiA`4i{YbmH(|7q~4O(<}S@!ru{2|2faE_28N2)IOh8Qs2sd-*9m+_un$A zgZ=YO&WkA)0q3*szi&~obN&QZ{(H#4)%@8mF6@V-{S7Yew7=27mHkZyuIxYT;$E(= zjqJmJk8n_oW@7~`7v?qpS>>b9N*IhuEzHr z16Skwu8Vv4`EpE-?-|ZBQFUnb{Z?XSMJO3!H8sij%*vK|8)PbK^+5m1R~DshKOOjn5+DsiVu+@%t}OxNkYed*49>E3d*oNs+GWh;>>bIj18WX<{8#OPf^@ zk9Epgk+WE1jrLlOs6;H6vxRtQtt1a%WMX6*W++vl-Qqh*Q>$uhmt0~o% zo`)9Xupl}@d{#v7kx*xXrIXy-iB!Bb)NIwq>aBP@6pk{hw3HqnJ$`xu%<@s*M|mIR zeU$f8-cNZy<^7ZoP(DEU0ObP#mK6Q)&clh?STdBfT4*F0eYEB>8M)*dtaviqOk^$V zV(X~-yl4y0M;fKpNaGyxp%o{_mwb{E)v*>wXXOnjfj2OREKGNtNaLc`R?OPV8%{Uc|%!s1{=G%|c#0&NR5HgExA|ZxaZ4 zHnVwxB4u0UVHvgZ_^*O!Q^3dOWmD+pIwez0OZ}$h$YYmImCZP|uk3d(9NEyX>%<*w zD4jx+(1~t!ow_zKrCFtgM$EyXS-Ew3ZPdLIov25C@R)S2db59-Kd@}i#{B+~N?SOD4nRI`LkTt38J)-=JM>c&?f3!ZJkF;R*(GPpGTW79lrg;0?(BH>N+uxL+Ql$ zl}=i_4xPHTh9#A0ohmK;$;)%-BlAY7%TiK-eP}>{(FMDHk4uAD%;u`=KE8$&(`U+QU6N! zC#n{T>S*Q&{cY7p^Y3ea>+m?=+fD?n#;h$9m@b6J>6lUR#t3+enMxz9&dv+@B?Lj@9lTIbqhX@^%iNxadHyu2c1j zw>k^l{sa{|;VWGyh|(tf$j?>ymLBJsgt}K#=PLty4ku15|NCp(C(oYy$c~3~ol27! zfzhAjALY;V_mi(%r3Y_qPo~r8SJgo}OXnxLKhOT-V9Dis-yX4R)5&h{*;k*|bz*-i zt!96U`>hzS`hHd^oqSCSjhX$a_9WVYD#O`&Q*`N4tvO9QQKYU=v zz9k!8dTY_!sUsua&~;*e4yBXE+AGgn8mIbxx^;qKtqMJk^~~o2njJbBlzMGymfkZ+ zi{REN0qxJ+I=z4T walkSpeed; + public float RunSpeed => runSpeed; + + [SerializeField] private float walkSpeed = 5; + [SerializeField] private float runSpeed = 8; // ----- // 상태 변수 @@ -29,10 +34,15 @@ public class EnemyController : CharacterBase private Dictionary _enemyStates; + private void Awake() + { + EnemyAnimator = GetComponent(); + Agent = GetComponent(); + } + protected override void Start() { base.Start(); - EnemyAnimator = GetComponent(); // 상태 객체 생성 _enemyStateIdle = new EnemyStateIdle(); @@ -84,10 +94,8 @@ public class EnemyController : CharacterBase { return hitColliders[0].transform; } - else - { - return null; - } + + return null; } #endregion diff --git a/Assets/Scripts/Character/Enemy/EnemyState/EnemyStateAttack.cs b/Assets/Scripts/Character/Enemy/EnemyState/EnemyStateAttack.cs index 965068e7..c320385b 100644 --- a/Assets/Scripts/Character/Enemy/EnemyState/EnemyStateAttack.cs +++ b/Assets/Scripts/Character/Enemy/EnemyState/EnemyStateAttack.cs @@ -1,16 +1,40 @@ -public class EnemyStateAttack : IEnemyState +using System.Collections; +using UnityEngine; + +public class EnemyStateAttack : IEnemyState { private EnemyController _enemyController; public void Enter(EnemyController enemyController) { _enemyController = enemyController; + _enemyController.EnemyAnimator.SetTrigger("Attack"); } public void Update() { + _enemyController.SetState(EnemyState.Trace); } + // private IEnumerator AttackSequence() + // { + // // 1. 전조 이펙트 생성 + // + // // 2. 검을 들어올리는 애니메이션 재생 + // + // // 3. 대기(전조와 검 들어올리는 애니메이션을 위함) + // + // // 4. 전조 제거 + // + // // 회전 초기화 + // + // // 5. 검 휘두르기 + // + // // 6. 공격 판정 발생 + // + // // 7. 상태 전환 + // } + public void Exit() { _enemyController = null; diff --git a/Assets/Scripts/Character/Enemy/EnemyState/EnemyStateTrace.cs b/Assets/Scripts/Character/Enemy/EnemyState/EnemyStateTrace.cs index f75d5ab7..def7ceb2 100644 --- a/Assets/Scripts/Character/Enemy/EnemyState/EnemyStateTrace.cs +++ b/Assets/Scripts/Character/Enemy/EnemyState/EnemyStateTrace.cs @@ -1,18 +1,122 @@ -public class EnemyStateTrace : IEnemyState +using UnityEngine; + +public class EnemyStateTrace : IEnemyState { + private static readonly int MoveSpeed = Animator.StringToHash("MoveSpeed"); + private static readonly int Trace = Animator.StringToHash("Trace"); + private EnemyController _enemyController; + private Transform _detectPlayerTransform; + + private const float MaxDetectPlayerInCircleWaitTime = 0.2f; + private float _detectPlayerInCircleWaitTime = 0f; + public void Enter(EnemyController enemyController) { _enemyController = enemyController; + + _detectPlayerTransform = _enemyController.DetectPlayerInCircle(); + if (!_detectPlayerTransform) + { + _enemyController.SetState(EnemyState.Idle); + return; + } + + if (_enemyController.Agent.enabled == true) + { + _enemyController.Agent.isStopped = false; + _enemyController.Agent.SetDestination(_detectPlayerTransform.position); + } + + _enemyController.EnemyAnimator.SetBool(Trace, true); } public void Update() { + // 일정 주기로 찾은 플레이어의 위치를 갱신해서 갱신된 위치로 이동 + FindTargetPosition(); + PlayerTracking(); + + if (_enemyController.Agent.remainingDistance <= _enemyController.Agent.stoppingDistance) + { + // TODO: 타겟에 도착함 -> 공격 준비 + _enemyController.SetState(EnemyState.Attack); + } + + } + + private void FindTargetPosition() + { + if (_detectPlayerInCircleWaitTime > MaxDetectPlayerInCircleWaitTime) + { + _enemyController.Agent.SetDestination(_detectPlayerTransform.position); + _detectPlayerInCircleWaitTime = 0f; + } + + _detectPlayerInCircleWaitTime += Time.deltaTime; + } + + // 플레이어를 추적하는 속도를 제어하는 함수 + private void PlayerTracking() + { + float distance = (_detectPlayerTransform.position - _enemyController.transform.position).magnitude; + + if (distance > 5f) + { + // 먼 거리: 뛰기 + _enemyController.Agent.speed = _enemyController.RunSpeed; + _enemyController.Agent.acceleration = 20f; + _enemyController.Agent.angularSpeed = 270f; + // _enemyController.EnemyAnimator.SetFloat("MoveSpeed", 1f); // 애니메이션도 Run으로 + + // NavMeshAgent 회전에 맡기기 + _enemyController.Agent.updateRotation = true; + } + else if (distance > 2f) + { + // 가까운 거리: 걷기 + _enemyController.Agent.speed = _enemyController.WalkSpeed; + _enemyController.Agent.acceleration = 8f; + _enemyController.Agent.angularSpeed = 720f; + // _enemyController.EnemyAnimator.SetFloat("MoveSpeed", 0.4f); // Walk 애니메이션 + + _enemyController.Agent.updateRotation = true; + } + else + { + // 매우 가까움: 직접 타겟 바라보기 + _enemyController.Agent.updateRotation = false; + + Vector3 direction = _detectPlayerTransform.position - _enemyController.transform.position; + direction.y = 0f; // 수직 회전 방지 + + if (direction.sqrMagnitude > 0.01f) + { + Quaternion lookRotation = Quaternion.LookRotation(direction); + _enemyController.transform.rotation = Quaternion.Slerp( + _enemyController.transform.rotation, + lookRotation, + Time.deltaTime * 10f // 회전 속도 + ); + } + + // _enemyController.Agent.angularSpeed = 1080f; + // _enemyController.Agent.acceleration = 999f; + + // _enemyController.EnemyAnimator.SetFloat("MoveSpeed", 0f); + } + + // 실제 속도 기반으로 애니메이션 제어 + float currentSpeed = _enemyController.Agent.velocity.magnitude; + _enemyController.EnemyAnimator.SetFloat(MoveSpeed, currentSpeed); } public void Exit() { + _detectPlayerTransform = null; + _enemyController.EnemyAnimator.SetBool(Trace, false); _enemyController = null; } -} \ No newline at end of file +} + diff --git a/Assets/Scripts/Character/Enemy/PldDogController.cs b/Assets/Scripts/Character/Enemy/PldDogController.cs index f35e059b..1a9eb28d 100644 --- a/Assets/Scripts/Character/Enemy/PldDogController.cs +++ b/Assets/Scripts/Character/Enemy/PldDogController.cs @@ -4,16 +4,4 @@ using UnityEngine; public class PldDogController : EnemyController { - - - private void Awake() - { - - } - - private void Update() - { - - } - } diff --git a/Assets/StoreAssets/DogKnight/Animations/Attack01.anim.meta b/Assets/StoreAssets/DogKnight/Animations/Attack01.anim.meta index f8e8feff..2d4f1ff7 100644 --- a/Assets/StoreAssets/DogKnight/Animations/Attack01.anim.meta +++ b/Assets/StoreAssets/DogKnight/Animations/Attack01.anim.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 6019f1b4a095b0b4396f5561a51fee89 -timeCreated: 1544605028 -licenseType: Store +guid: 68de4930eebde9e479eaab7c237d2746 NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/StoreAssets/DogKnight/Animations/Attack02.anim.meta b/Assets/StoreAssets/DogKnight/Animations/Attack02.anim.meta index 6d2fbfcc..ebea61de 100644 --- a/Assets/StoreAssets/DogKnight/Animations/Attack02.anim.meta +++ b/Assets/StoreAssets/DogKnight/Animations/Attack02.anim.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: eccbae3cfc77ad245ade46e143aa3200 -timeCreated: 1544605040 -licenseType: Store +guid: ff79b845bee80594a98ec31de14b5ecd NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/StoreAssets/DogKnight/Animations/Defend.anim.meta b/Assets/StoreAssets/DogKnight/Animations/Defend.anim.meta index a1310b87..9c4cc3e5 100644 --- a/Assets/StoreAssets/DogKnight/Animations/Defend.anim.meta +++ b/Assets/StoreAssets/DogKnight/Animations/Defend.anim.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: cf357b5409b4ad54a82c45d7684564e1 -timeCreated: 1544607741 -licenseType: Store +guid: 5b0776984ffd79842a0465fb8a419441 NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/StoreAssets/DogKnight/Animations/Die.anim.meta b/Assets/StoreAssets/DogKnight/Animations/Die.anim.meta index 3ed5768a..3f8a3143 100644 --- a/Assets/StoreAssets/DogKnight/Animations/Die.anim.meta +++ b/Assets/StoreAssets/DogKnight/Animations/Die.anim.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 5d190d8211c88a64281f7b90c69f3eb3 -timeCreated: 1544605073 -licenseType: Store +guid: cef708be761542448b42d1f5e4d1d5e6 NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/StoreAssets/DogKnight/Animations/DieRecover.anim b/Assets/StoreAssets/DogKnight/Animations/DieRecover.anim index c205f785..d8e064df 100644 --- a/Assets/StoreAssets/DogKnight/Animations/DieRecover.anim +++ b/Assets/StoreAssets/DogKnight/Animations/DieRecover.anim @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7eab6f2d54dd8af46d30b679d2319edd14456f988f5c674022bcf3bac2252df +oid sha256:460540d5faabb3b676215b186bd9ee6fad7a50837c092ed84805169177fa1d83 size 606894 diff --git a/Assets/StoreAssets/DogKnight/Animations/DieRecover.anim.meta b/Assets/StoreAssets/DogKnight/Animations/DieRecover.anim.meta index 1e729a3b..7c03fefc 100644 --- a/Assets/StoreAssets/DogKnight/Animations/DieRecover.anim.meta +++ b/Assets/StoreAssets/DogKnight/Animations/DieRecover.anim.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 4a3671dbe6670524b8b6d9ad3664c179 -timeCreated: 1544607752 -licenseType: Store +guid: 7e5e21c2814211745a93c59b744df10e NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/StoreAssets/DogKnight/Animations/Dizzy.anim.meta b/Assets/StoreAssets/DogKnight/Animations/Dizzy.anim.meta index b756a13d..07980a65 100644 --- a/Assets/StoreAssets/DogKnight/Animations/Dizzy.anim.meta +++ b/Assets/StoreAssets/DogKnight/Animations/Dizzy.anim.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 30d4fe7af77240a44b9354aaed8e5beb -timeCreated: 1544607757 -licenseType: Store +guid: 6295306c82f8e6b49938378b3666db48 NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/StoreAssets/DogKnight/Animations/GetHit.anim.meta b/Assets/StoreAssets/DogKnight/Animations/GetHit.anim.meta index 22ca0541..666b94ee 100644 --- a/Assets/StoreAssets/DogKnight/Animations/GetHit.anim.meta +++ b/Assets/StoreAssets/DogKnight/Animations/GetHit.anim.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 1588532e68f51a040bda71c68cfab177 -timeCreated: 1544605085 -licenseType: Store +guid: 2b359afc6c4d41a4eb986dd6103e0f90 NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/StoreAssets/DogKnight/Animations/Idle_Battle.anim.meta b/Assets/StoreAssets/DogKnight/Animations/Idle_Battle.anim.meta index ed48298b..2db69b2d 100644 --- a/Assets/StoreAssets/DogKnight/Animations/Idle_Battle.anim.meta +++ b/Assets/StoreAssets/DogKnight/Animations/Idle_Battle.anim.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: b79ff7bb68348be479d3db6b7fe8a569 -timeCreated: 1544605090 -licenseType: Store +guid: 3ec08e68e04f63f4393c07f4246dce96 NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/StoreAssets/DogKnight/Animations/RunForwardBattle.anim b/Assets/StoreAssets/DogKnight/Animations/RunForwardBattle.anim index 2f48b050..bf68a90e 100644 --- a/Assets/StoreAssets/DogKnight/Animations/RunForwardBattle.anim +++ b/Assets/StoreAssets/DogKnight/Animations/RunForwardBattle.anim @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:892393373935cc7635222d531887fac334efcd0755dc02482e5cfafe2192239e +oid sha256:571e16dde03ce0f7c5be77b1db916e8ac2adf08041270dab3452274b18accf48 size 502807 diff --git a/Assets/StoreAssets/DogKnight/Animations/RunForwardBattle.anim.meta b/Assets/StoreAssets/DogKnight/Animations/RunForwardBattle.anim.meta index 0fca8d27..a9a61ed8 100644 --- a/Assets/StoreAssets/DogKnight/Animations/RunForwardBattle.anim.meta +++ b/Assets/StoreAssets/DogKnight/Animations/RunForwardBattle.anim.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 9f0e03164414016409d28995a128ba98 -timeCreated: 1544605137 -licenseType: Store +guid: 6253b377de3be0f4897ab40c9921af28 NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/StoreAssets/DogKnight/Animations/WalkForwardBattle.anim.meta b/Assets/StoreAssets/DogKnight/Animations/WalkForwardBattle.anim.meta index 80e93aa1..78dc0a60 100644 --- a/Assets/StoreAssets/DogKnight/Animations/WalkForwardBattle.anim.meta +++ b/Assets/StoreAssets/DogKnight/Animations/WalkForwardBattle.anim.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: f0c8c1d913b359a428b42d53947d3e93 -timeCreated: 1544607284 -licenseType: Store +guid: 82ae7cd6e51ade24b9467d436d2d7482 NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 userData: assetBundleName: assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 5c954c5d..aeb9e2ae 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,5 +1,6 @@ { "dependencies": { + "com.unity.ai.navigation": "1.1.5", "com.unity.collab-proxy": "2.7.1", "com.unity.ide.rider": "3.0.34", "com.unity.ide.visualstudio": "2.0.22", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index cab487ab..9c86ceac 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,5 +1,14 @@ { "dependencies": { + "com.unity.ai.navigation": { + "version": "1.1.5", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.ai": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.burst": { "version": "1.8.19", "depth": 1, diff --git a/ProjectSettings/NavMeshAreas.asset b/ProjectSettings/NavMeshAreas.asset index 3b0b7c3d..dcf4931c 100644 --- a/ProjectSettings/NavMeshAreas.asset +++ b/ProjectSettings/NavMeshAreas.asset @@ -71,10 +71,10 @@ NavMeshProjectSettings: cost: 1 m_LastAgentTypeID: -887442657 m_Settings: - - serializedVersion: 2 + - serializedVersion: 3 agentTypeID: 0 agentRadius: 0.5 - agentHeight: 2 + agentHeight: 1.5 agentSlope: 45 agentClimb: 0.75 ledgeDropHeight: 0 @@ -84,7 +84,9 @@ NavMeshProjectSettings: cellSize: 0.16666667 manualTileSize: 0 tileSize: 256 - accuratePlacement: 0 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 debug: m_Flags: 0 m_SettingNames: diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 1c92a784..c7d46f92 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -3,7 +3,8 @@ --- !u!78 &1 TagManager: serializedVersion: 2 - tags: [] + tags: + - FxTemporaire layers: - Default - TransparentFX @@ -36,7 +37,7 @@ TagManager: - - - - - + - Player m_SortingLayers: - name: Default uniqueID: 0