From 6916b936e3c68b0a360c69c9d905c0df6998dd5f Mon Sep 17 00:00:00 2001 From: Ino Date: Sat, 8 Mar 2025 08:45:34 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=BC=EA=BE=BC=20=EC=9D=BC=EB=8B=A8=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Editor/MyEditorUtil.cs | 28 +++----- Assets/Res_Addr/Map/Map_C01.prefab | 3 +- Assets/Res_Addr/Obj/DropItem_Coin.prefab | 23 ------- Assets/Res_Addr/Worker/Goblin_Baby.prefab | 40 +++++++++-- Assets/Script/Character/Actor.cs | 17 +++-- Assets/Script/Character/WorkerActor.cs | 84 ++++++++++------------- Assets/Script/DropItem/DropItem.cs | 2 +- 7 files changed, 88 insertions(+), 109 deletions(-) diff --git a/Assets/Editor/MyEditorUtil.cs b/Assets/Editor/MyEditorUtil.cs index 146aac3bf..bd6af3eda 100644 --- a/Assets/Editor/MyEditorUtil.cs +++ b/Assets/Editor/MyEditorUtil.cs @@ -166,7 +166,7 @@ public static class MyEditorUtil var longd = go.GetComponent(); if (longd == null) go.AddComponent(); - CommonSetting(go, 51); + CommonSetting(go, ObstacleAvoidanceType.LowQualityObstacleAvoidance, 51, "Actor"); } } @@ -181,7 +181,7 @@ public static class MyEditorUtil if (ma == null) ma = go.AddComponent(); ma.m_Role = eRole.Pet; - CommonSetting(go, 51); + CommonSetting(go, ObstacleAvoidanceType.LowQualityObstacleAvoidance, 51, "Actor"); } } [MenuItem("Edit/PCSetting", false, -1003)] @@ -216,7 +216,7 @@ public static class MyEditorUtil navmesh.avoidancePriority = 50; navmesh.obstacleAvoidanceType = ObstacleAvoidanceType.LowQualityObstacleAvoidance; - Set_CommonRigidBody(prefabAsset); + Set_CommonRigidBody(prefabAsset, "Actor"); var cc = prefabAsset.GetComponent(); if (cc == null) cc = prefabAsset.AddComponent(); @@ -327,7 +327,7 @@ public static class MyEditorUtil return null; } - static void CommonSetting(GameObject go, int avoidancePriority) + static void CommonSetting(GameObject go, ObstacleAvoidanceType avoid, int avoidancePriority, string layer) { Set_Collideer(go); @@ -340,13 +340,13 @@ public static class MyEditorUtil navmesh.autoBraking = true; navmesh.radius = 0.25f; navmesh.avoidancePriority = avoidancePriority; - navmesh.obstacleAvoidanceType = ObstacleAvoidanceType.LowQualityObstacleAvoidance; + navmesh.obstacleAvoidanceType = avoid; - Set_CommonRigidBody(go); + Set_CommonRigidBody(go, layer); } - static void Set_CommonRigidBody(GameObject go) + static void Set_CommonRigidBody(GameObject go, string layer) { - go.layer = LayerMask.NameToLayer("Actor"); + go.layer = LayerMask.NameToLayer(layer); var rigidbody = go.GetComponent(); if (rigidbody == null) rigidbody = go.AddComponent(); rigidbody.useGravity = false; @@ -406,17 +406,7 @@ public static class MyEditorUtil var wa = go.GetComponent(); if (wa == null) wa = go.AddComponent(); - var navmesh = go.GetComponent(); - if (navmesh == null) navmesh = go.AddComponent(); - - // NavMeshAgent 설정 - navmesh.angularSpeed = 120f; - navmesh.acceleration = 1000f; - navmesh.radius = 0.1f; - navmesh.height = 1f; - navmesh.obstacleAvoidanceType = ObstacleAvoidanceType.NoObstacleAvoidance; - - Set_Collideer(go); + CommonSetting(go, ObstacleAvoidanceType.NoObstacleAvoidance, 0, "Default"); } } diff --git a/Assets/Res_Addr/Map/Map_C01.prefab b/Assets/Res_Addr/Map/Map_C01.prefab index 71aeeef03..33ce4a64d 100644 --- a/Assets/Res_Addr/Map/Map_C01.prefab +++ b/Assets/Res_Addr/Map/Map_C01.prefab @@ -73500,7 +73500,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 55d2c951f510f3241994bf8cdd83e312, type: 3} m_Name: m_EditorClassIdentifier: - go_Camera: {fileID: 0} --- !u!1 &6260398950048915527 GameObject: m_ObjectHideFlags: 0 @@ -76802,7 +76801,7 @@ PrefabInstance: - target: {fileID: 960630095900046633, guid: 73c6a05b987c3214f9d0c6ae8a803da6, type: 3} propertyPath: m_LocalPosition.x - value: 113 + value: 58.4 objectReference: {fileID: 0} - target: {fileID: 960630095900046633, guid: 73c6a05b987c3214f9d0c6ae8a803da6, type: 3} diff --git a/Assets/Res_Addr/Obj/DropItem_Coin.prefab b/Assets/Res_Addr/Obj/DropItem_Coin.prefab index 00c1708f2..123edaf7e 100644 --- a/Assets/Res_Addr/Obj/DropItem_Coin.prefab +++ b/Assets/Res_Addr/Obj/DropItem_Coin.prefab @@ -83,7 +83,6 @@ GameObject: - component: {fileID: 3840684917986916439} - component: {fileID: 5254117875007108769} - component: {fileID: 8691887067622214584} - - component: {fileID: 2169718913078083463} m_Layer: 0 m_Name: Coin m_TagString: Untagged @@ -156,25 +155,3 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!64 &2169718913078083463 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8770474071504360176} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 0 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 5 - m_Convex: 0 - m_CookingOptions: 30 - m_Mesh: {fileID: -127844609115117539, guid: f48a1b3e05cf7d94f9ec9b272c050643, type: 3} diff --git a/Assets/Res_Addr/Worker/Goblin_Baby.prefab b/Assets/Res_Addr/Worker/Goblin_Baby.prefab index 4404ea65e..181d51469 100644 --- a/Assets/Res_Addr/Worker/Goblin_Baby.prefab +++ b/Assets/Res_Addr/Worker/Goblin_Baby.prefab @@ -145,6 +145,7 @@ GameObject: - component: {fileID: 6377084992631546431} - component: {fileID: 2897636524652675864} - component: {fileID: -9032171624714911403} + - component: {fileID: 6444794995727187772} m_Layer: 0 m_Name: Goblin_Baby m_TagString: Untagged @@ -219,12 +220,12 @@ NavMeshAgent: m_GameObject: {fileID: 1946639791678223188} m_Enabled: 1 m_AgentTypeID: 0 - m_Radius: 0.1 - m_Speed: 3.5 - m_Acceleration: 1000 - avoidancePriority: 50 - m_AngularSpeed: 120 - m_StoppingDistance: 0 + m_Radius: 0.25 + m_Speed: 4.5 + m_Acceleration: 140 + avoidancePriority: 0 + m_AngularSpeed: 300 + m_StoppingDistance: 0.1 m_AutoTraverseOffMeshLink: 1 m_AutoBraking: 1 m_AutoRepath: 1 @@ -253,6 +254,33 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 0.85087365, y: 1.4576797, z: 0.48206693} m_Center: {x: -0.00000008940697, y: 0.22931978, z: 0.011348151} +--- !u!54 &6444794995727187772 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1946639791678223188} + serializedVersion: 4 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_CenterOfMass: {x: 0, y: 0, z: 0} + m_InertiaTensor: {x: 1, y: 1, z: 1} + m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ImplicitCom: 1 + m_ImplicitTensor: 1 + m_UseGravity: 0 + m_IsKinematic: 0 + m_Interpolate: 0 + m_Constraints: 126 + m_CollisionDetection: 0 --- !u!1 &2288852919550759396 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Script/Character/Actor.cs b/Assets/Script/Character/Actor.cs index d586ca62f..eff41b0e9 100644 --- a/Assets/Script/Character/Actor.cs +++ b/Assets/Script/Character/Actor.cs @@ -620,20 +620,19 @@ public class Actor : MyCoroutine break; case eRole.PC: //InGameInfo.Ins.Defeat_byMonster(); - // 소환수 이동 - var summ = ActorInfo.Ins.Get_Actor(eRole.Summon); - if (!DSUtil.CheckNull(summ)) summ.On_Regen(); - // 펫 부활 - var pet = ActorInfo.Ins.Get_Actor(eRole.Pet); - if (!DSUtil.CheckNull(pet)) pet.On_Regen(); - // 일꾼 이동 + // PC 부활 + On_Regen(); if (!IsEnemy()) { + // 소환수 이동 + var summ = ActorInfo.Ins.Get_Actor(eRole.Summon); + if (!DSUtil.CheckNull(summ)) summ.On_Regen(); + // 펫 부활 + if (!DSUtil.CheckNull(m_MyPet)) m_MyPet.On_Regen(); + // 일꾼 이동 var worker = ActorInfo.Ins.Get_Actor(eRole.Worker); if (!DSUtil.CheckNull(worker)) worker.On_Regen(); } - // PC 부활 - On_Regen(); break; } } diff --git a/Assets/Script/Character/WorkerActor.cs b/Assets/Script/Character/WorkerActor.cs index e85ffe016..69f12cb41 100644 --- a/Assets/Script/Character/WorkerActor.cs +++ b/Assets/Script/Character/WorkerActor.cs @@ -3,7 +3,13 @@ using UnityEngine; public class WorkerActor : Actor { WorkerListTableData m_WorkerListTableData; - DropItem go_finditem; + DropItem _finditem; + DropItem go_finditem + { + get { return _finditem; } + set { _finditem = value; isFinditem = _finditem; } + } + bool isFinditem; float SeekTime = 5f, t; Actor m_Owner; bool isOwner; @@ -16,7 +22,7 @@ public class WorkerActor : Actor m_Role = eRole.Worker; m_Owner = owner; isOwner = m_Owner; - //m_Stat = new ActorStatInfo(m_Role, sdata, null); + m_Stat = new ActorStatInfo(m_Role, sdata, null); m_WorkerListTableData = table_worker.Ins.Get_Data_orNull(_id); if (!_ui) @@ -31,6 +37,7 @@ public class WorkerActor : Actor public override void On_Regen(bool reincarnation = false, float healrate = 1) { + Status = 0; Set_Warp(Get_Pos()); } @@ -45,29 +52,17 @@ public class WorkerActor : Actor switch (Status) { case 0: // 대기 중 - if (DSUtil.CheckNull(go_finditem) || !go_finditem.gameObject.activeInHierarchy) + if (!isFinditem || !go_finditem.gameObject.activeInHierarchy) go_finditem = DropItemInfo.Ins.Get_NearestDropItem(Get_position()); - if (t > 0f) + if (t <= 0f && go_finditem && Set_Path(go_finditem.transform.position)) { - if (go_finditem) - { // 다음 아이템으로 미리 가서 대기 - Play_Run(); - Set_Path(go_finditem.transform.position); - Status = 3; - } - } - else - { - if (go_finditem && Set_Path(go_finditem.transform.position)) - { - Play_Run(); - Status = 2; - } + Play_Run(); + Status = 2; } - if (Status == 0 && isOwner && Vector3.Distance(m_Owner.Get_position(), Get_position()) > 3f) - { // 캐릭터 근처로 옴 + if (!isFinditem && Status == 0 && isOwner && Vector3.Distance(m_Owner.Get_position(), Get_position()) > 3f) + { // 아이템이 없으므로 캐릭터 근처로 옴 Play_Run(); Set_Path(Get_Pos()); Status = 1; @@ -84,37 +79,10 @@ public class WorkerActor : Actor if (CurAnim >= eAnim.Attack) { if (!isPlaying()) - { - Play_Idle(); - Status = 0; - t = SeekTime; - } + End_Run(); } else if (Complete_Destination()) - { - if (!DSUtil.CheckNull(go_finditem)) - { - if (go_finditem.gameObject.activeInHierarchy) - { - Play_Attack(Random.Range(0, 2), 1f); - if (go_finditem.ItemTouch(this)) - ServerInfo.Ins.m_ServerData.Add_TitleCondition(46, 47); // 칭호 : 요정은 내 친구, 요정은 내 노예 - } - else - { - Play_Idle(); - Status = 0; - t = SeekTime; - } - go_finditem = null; - } - else - { - Play_Idle(); - Status = 0; - t = SeekTime; - } - } + End_Run(); break; case 3: // 아무것도 안함 if (CurAnim != eAnim.Idle && Complete_Destination()) @@ -124,4 +92,22 @@ public class WorkerActor : Actor break; } } + + void End_Run() + { + Play_Idle(); + Status = 0; + t = SeekTime; + } + + private void OnTriggerEnter(Collider other) + { + var dropitem = other.GetComponent(); + if (dropitem) + { + dropitem.ItemTouch(this); + if (go_finditem == dropitem) + go_finditem = null; + } + } } \ No newline at end of file diff --git a/Assets/Script/DropItem/DropItem.cs b/Assets/Script/DropItem/DropItem.cs index 14a2fc36b..19b02db01 100644 --- a/Assets/Script/DropItem/DropItem.cs +++ b/Assets/Script/DropItem/DropItem.cs @@ -98,7 +98,7 @@ public class DropItem : ProjectileBase { if (gameObject.activeInHierarchy && touchActor) { - if (touchActor.IsRole(eRole.PC) || touchActor.IsRole(eRole.Fairy)) + if (touchActor.IsRole(eRole.PC) || touchActor.IsRole(eRole.Worker)) { var sdata = ServerInfo.Ins.m_ServerData; var statdata = touchActor.Get_StatInfo();