diff --git a/Assets/_Scenes/DevRoom.unity b/Assets/_Scenes/DevRoom.unity index e5fc88215f9b01f9856ff15cadf6f35eff45eabc..f6007d13904cfb189a4fa96986797c793267fe5f 100644 --- a/Assets/_Scenes/DevRoom.unity +++ b/Assets/_Scenes/DevRoom.unity @@ -119,6 +119,53 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &11003743 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 11003744} + - component: {fileID: 11003745} + m_Layer: 0 + m_Name: '[generated-meshes]' + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &11003744 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 11003743} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1237617630} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &11003745 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 11003743} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5c3643d4978096d4880d7edbf4f65a50, type: 3} + m_Name: + m_EditorClassIdentifier: + Version: 1 + owner: {fileID: 1237617629} + helperSurfaces: [] --- !u!43 &28665006 Mesh: m_ObjectHideFlags: 16 @@ -396,7 +443,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 50582 + surfaceParameter: 49340 meshQueryIndex: 6 subMeshQueryIndex: 0 geometryHashValue: 3240074839323548863 @@ -939,7 +986,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 50438 + surfaceParameter: 49192 meshQueryIndex: 7 subMeshQueryIndex: 0 geometryHashValue: 3008546525906852216 @@ -2796,7 +2843,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8116154848368178863, guid: bbf8b8bb5e2f2e04e93f5beaf9fc2d42, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -4198,7 +4245,7 @@ MonoBehaviour: meshQuery: layers: 33554440 maskAndChannels: 8 - surfaceParameter: 50400 + surfaceParameter: 49154 meshQueryIndex: 2 subMeshQueryIndex: 0 geometryHashValue: -1365392548276624071 @@ -5283,7 +5330,7 @@ MonoBehaviour: meshQuery: layers: 33554440 maskAndChannels: 8 - surfaceParameter: 50400 + surfaceParameter: 49154 meshQueryIndex: 2 subMeshQueryIndex: 0 geometryHashValue: -1365392548276624071 @@ -6803,7 +6850,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8491347043216026353, guid: 7e312250336c0244193b4b75151d4fe3, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -7470,7 +7517,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 50474 + surfaceParameter: 49230 meshQueryIndex: 0 subMeshQueryIndex: 0 geometryHashValue: -2436489981782101099 @@ -7963,6 +8010,102 @@ Mesh: offset: 0 size: 0 path: +--- !u!1 &1237617627 +GameObject: + m_ObjectHideFlags: 17 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1237617630} + - component: {fileID: 1237617629} + - component: {fileID: 1237617628} + m_Layer: 0 + m_Name: '[default-CSGModel]' + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 124 + m_IsActive: 1 +--- !u!54 &1237617628 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1237617627} + 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: 1 + m_Interpolate: 0 + m_Constraints: 126 + m_CollisionDetection: 0 +--- !u!114 &1237617629 +MonoBehaviour: + m_ObjectHideFlags: 17 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1237617627} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8672dcc90e16b0a489a41edf56e016f8, type: 3} + m_Name: + m_EditorClassIdentifier: + PrefabBehaviour: 0 + PrefabSourceAlignment: 4 + PrefabDestinationAlignment: 0 + Version: 1.1 + infiniteBrush: {fileID: 0} + Settings: 1025 + VertexChannels: 14 + ReceiveGI: 2 + MeshColliderCookingOptions: 14 + ShowGeneratedMeshes: 0 + DefaultPhysicsMaterial: {fileID: 13400000, guid: 0c5fdfb44d6f19646a41a0720fbf751a, type: 2} + exportType: 0 + originType: 0 + exportColliders: 0 + exportPath: + angleError: 1 + areaError: 1 + hardAngle: 60 + packMargin: 20 + scaleInLightmap: 1 + autoUVMaxDistance: 0.5 + autoUVMaxAngle: 89 + minimumChartSize: 4 +--- !u!4 &1237617630 +Transform: + m_ObjectHideFlags: 17 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1237617627} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 11003744} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1250453138 GameObject: m_ObjectHideFlags: 0 @@ -9600,7 +9743,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 50062 + surfaceParameter: 48812 meshQueryIndex: 8 subMeshQueryIndex: 0 geometryHashValue: 6467234982613496563 @@ -10099,102 +10242,6 @@ MonoBehaviour: m_MinRegionArea: 2 m_NavMeshData: {fileID: 23800000, guid: 6a2cc2015181cbe49bdf14754d091c1e, type: 2} m_BuildHeightMesh: 0 ---- !u!1 &1615555676 -GameObject: - m_ObjectHideFlags: 17 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1615555679} - - component: {fileID: 1615555678} - - component: {fileID: 1615555677} - m_Layer: 0 - m_Name: '[default-CSGModel]' - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 124 - m_IsActive: 1 ---- !u!54 &1615555677 -Rigidbody: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1615555676} - 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: 1 - m_Interpolate: 0 - m_Constraints: 126 - m_CollisionDetection: 0 ---- !u!114 &1615555678 -MonoBehaviour: - m_ObjectHideFlags: 17 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1615555676} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8672dcc90e16b0a489a41edf56e016f8, type: 3} - m_Name: - m_EditorClassIdentifier: - PrefabBehaviour: 0 - PrefabSourceAlignment: 4 - PrefabDestinationAlignment: 0 - Version: 1.1 - infiniteBrush: {fileID: 0} - Settings: 1025 - VertexChannels: 14 - ReceiveGI: 2 - MeshColliderCookingOptions: 14 - ShowGeneratedMeshes: 0 - DefaultPhysicsMaterial: {fileID: 13400000, guid: 0c5fdfb44d6f19646a41a0720fbf751a, type: 2} - exportType: 0 - originType: 0 - exportColliders: 0 - exportPath: - angleError: 1 - areaError: 1 - hardAngle: 60 - packMargin: 20 - scaleInLightmap: 1 - autoUVMaxDistance: 0.5 - autoUVMaxAngle: 89 - minimumChartSize: 4 ---- !u!4 &1615555679 -Transform: - m_ObjectHideFlags: 17 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1615555676} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 1954889776} - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!43 &1635427727 Mesh: m_ObjectHideFlags: 0 @@ -10523,7 +10570,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 49740 + surfaceParameter: 48488 meshQueryIndex: 1 subMeshQueryIndex: 0 geometryHashValue: 8624144165243009415 @@ -12295,7 +12342,7 @@ MonoBehaviour: meshQuery: layers: 16777223 maskAndChannels: 234881031 - surfaceParameter: 49906 + surfaceParameter: 48656 meshQueryIndex: 9 subMeshQueryIndex: 0 geometryHashValue: -2774585206094123893 @@ -12389,53 +12436,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1954889775 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1954889776} - - component: {fileID: 1954889777} - m_Layer: 0 - m_Name: '[generated-meshes]' - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1954889776 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1954889775} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1615555679} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1954889777 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1954889775} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5c3643d4978096d4880d7edbf4f65a50, type: 3} - m_Name: - m_EditorClassIdentifier: - Version: 1 - owner: {fileID: 1615555678} - helperSurfaces: [] --- !u!1 &1993262141 GameObject: m_ObjectHideFlags: 0 @@ -18378,7 +18378,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1633179406371402833, guid: 6bbd1cf0f3b1c0a47b829b17d85e8529, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -18439,7 +18439,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8311580720870795455, guid: 49a58f77228fc1844b97a3403b1cbc8f, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -18500,7 +18500,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5459024695530754787, guid: 80b7b1ac5a0a72044b8c3c65220687d7, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -18561,7 +18561,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8116154848368178863, guid: 63009b5528003a4469e908d291dff8a9, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -18577,4 +18577,4 @@ SceneRoots: - {fileID: 1899092101} - {fileID: 683164257} - {fileID: 1298502551} - - {fileID: 1615555679} + - {fileID: 1237617630} diff --git a/Assets/_Scripts/Core/Entities/Mobs/General/GeneralStateController.cs b/Assets/_Scripts/Core/Entities/Mobs/General/GeneralStateController.cs index af86d56b342305f3b4065b4c3cb8b453402a1579..b990935b77929e7d1fc24728f2fdf7af7e49dd1d 100644 --- a/Assets/_Scripts/Core/Entities/Mobs/General/GeneralStateController.cs +++ b/Assets/_Scripts/Core/Entities/Mobs/General/GeneralStateController.cs @@ -135,11 +135,14 @@ public class GeneralStateController : EntityStateController public void VisualizePatrolRoute(General general) { - Gizmos.color = Color.cyan; - for (int i = 0; i < general.aiController.patrolRoute.Count - 1; i++) + if(general.aiController.patrolRoute.Count > 1) { - Gizmos.DrawLine(general.aiController.patrolRoute[i].position, general.aiController.patrolRoute[i + 1].position); + Gizmos.color = Color.cyan; + for (int i = 0; i < general.aiController.patrolRoute.Count - 1; i++) + { + Gizmos.DrawLine(general.aiController.patrolRoute[i].position, general.aiController.patrolRoute[i + 1].position); + } + Gizmos.DrawLine(general.aiController.patrolRoute[^1].position, general.aiController.patrolRoute[0].position); } - Gizmos.DrawLine(general.aiController.patrolRoute[^1].position, general.aiController.patrolRoute[0].position); } } diff --git a/Assets/_Scripts/Core/Entities/Mobs/Goon/GoonAIController.cs b/Assets/_Scripts/Core/Entities/Mobs/Goon/GoonAIController.cs index 217c1a498c75e31e002fba6484c52f816b2656e1..6f5b2354e33c7ae09fc51dbbd7d25c60c3db07c2 100644 --- a/Assets/_Scripts/Core/Entities/Mobs/Goon/GoonAIController.cs +++ b/Assets/_Scripts/Core/Entities/Mobs/Goon/GoonAIController.cs @@ -34,7 +34,6 @@ public class GoonAIController switch (GoonState.GetAIState(goon.stateController.State)) { case GoonState.AI_PATROL_STATE: - Debug.Log("Going"); if(patrolRoute.Count > 0) { GoToward(patrolRoute[patrolIndex]); diff --git a/Assets/_Scripts/Core/Entities/Mobs/Goon/GoonStateController.cs b/Assets/_Scripts/Core/Entities/Mobs/Goon/GoonStateController.cs index f39a66ba2d3ad9a8c70063c0cacee21f7aa481ac..0365d40512f2c9f661b21da51b8f656d696447f4 100644 --- a/Assets/_Scripts/Core/Entities/Mobs/Goon/GoonStateController.cs +++ b/Assets/_Scripts/Core/Entities/Mobs/Goon/GoonStateController.cs @@ -128,11 +128,14 @@ public class GoonStateController : EntityStateController public void VisualizePatrolRoute(Goon goon) { - Gizmos.color = Color.cyan; - for (int i = 0; i < goon.aiController.patrolRoute.Count - 1; i++) + if(goon.aiController.patrolRoute.Count > 1) { - Gizmos.DrawLine(goon.aiController.patrolRoute[i].position, goon.aiController.patrolRoute[i + 1].position); + Gizmos.color = Color.cyan; + for (int i = 0; i < goon.aiController.patrolRoute.Count - 1; i++) + { + Gizmos.DrawLine(goon.aiController.patrolRoute[i].position, goon.aiController.patrolRoute[i + 1].position); + } + Gizmos.DrawLine(goon.aiController.patrolRoute[^1].position, goon.aiController.patrolRoute[0].position); } - Gizmos.DrawLine(goon.aiController.patrolRoute[^1].position, goon.aiController.patrolRoute[0].position); } } diff --git a/Assets/_Scripts/Core/Entities/Mobs/HeadGoon/HeadGoon.cs b/Assets/_Scripts/Core/Entities/Mobs/HeadGoon/HeadGoon.cs index 72eefb0cc7b004eea18c30b482d0a3c0a4ea0362..bad5472e352b65e30627d2348de05019b75303f8 100644 --- a/Assets/_Scripts/Core/Entities/Mobs/HeadGoon/HeadGoon.cs +++ b/Assets/_Scripts/Core/Entities/Mobs/HeadGoon/HeadGoon.cs @@ -43,7 +43,8 @@ public class HeadGoon : EnemyEntity { Goon goon = ObjectFactory.CreateEntity<Goon>( prefabPath: GOON_PREFAB, - position: transform.position + transform.up + position: transform.position + transform.up, + objectName: $"{name}'s Goons" ); goon.OnDeathEvent += OnGoonDeath; goonCount++; diff --git a/Assets/_Scripts/Core/Entities/Mobs/HeadGoon/HeadGoonStateController.cs b/Assets/_Scripts/Core/Entities/Mobs/HeadGoon/HeadGoonStateController.cs index 84e53ab4027dfa98109d1d16798024639cd47ddb..99fc7f5d46f4163948a7d7a657293c6db63d0583 100644 --- a/Assets/_Scripts/Core/Entities/Mobs/HeadGoon/HeadGoonStateController.cs +++ b/Assets/_Scripts/Core/Entities/Mobs/HeadGoon/HeadGoonStateController.cs @@ -131,11 +131,14 @@ public class HeadGoonStateController : EntityStateController public void VisualizePatrolRoute(HeadGoon headGoon) { - Gizmos.color = Color.cyan; - for (int i = 0; i < headGoon.aiController.patrolRoute.Count - 1; i++) + if(headGoon.aiController.patrolRoute.Count > 1) { - Gizmos.DrawLine(headGoon.aiController.patrolRoute[i].position, headGoon.aiController.patrolRoute[i + 1].position); + Gizmos.color = Color.cyan; + for (int i = 0; i < headGoon.aiController.patrolRoute.Count - 1; i++) + { + Gizmos.DrawLine(headGoon.aiController.patrolRoute[i].position, headGoon.aiController.patrolRoute[i + 1].position); + } + Gizmos.DrawLine(headGoon.aiController.patrolRoute[^1].position, headGoon.aiController.patrolRoute[0].position); } - Gizmos.DrawLine(headGoon.aiController.patrolRoute[^1].position, headGoon.aiController.patrolRoute[0].position); } } diff --git a/Assets/_Scripts/Core/Entities/Mobs/King/King.cs b/Assets/_Scripts/Core/Entities/Mobs/King/King.cs index b59d6651f448dbbe68737203e8ed0cb97a98a44c..a32da9fbcb3264c6bc05e0ac6d7171487967b9ed 100644 --- a/Assets/_Scripts/Core/Entities/Mobs/King/King.cs +++ b/Assets/_Scripts/Core/Entities/Mobs/King/King.cs @@ -83,13 +83,15 @@ public class King : BossEntity { goon = ObjectFactory.CreateEntity<Goon>( prefabPath: GOON_RIFLE_PREFAB, - position: transform.position + transform.up + position: transform.position + transform.up, + objectName: $"{name}'s Goons" ); } else{ goon = ObjectFactory.CreateEntity<Goon>( prefabPath: GOON_PREFAB, - position: transform.position + transform.up + position: transform.position + transform.up, + objectName: $"{name}'s Goons" ); } goon.stateController.detectionDistance = stateController.detectionDistance; diff --git a/Assets/_Scripts/Core/Entities/Mobs/King/KingStateController.cs b/Assets/_Scripts/Core/Entities/Mobs/King/KingStateController.cs index a2815c899cbd89e6f1c2af24a215f05b512be181..0c105efbe591e7ab6ca781ae78f2268a7015f384 100644 --- a/Assets/_Scripts/Core/Entities/Mobs/King/KingStateController.cs +++ b/Assets/_Scripts/Core/Entities/Mobs/King/KingStateController.cs @@ -152,11 +152,14 @@ public class KingStateController : EntityStateController public void VisualizePatrolRoute(King king) { - Gizmos.color = Color.cyan; - for (int i = 0; i < king.aiController.patrolRoute.Count - 1; i++) + if(king.aiController.patrolRoute.Count > 1) { - Gizmos.DrawLine(king.aiController.patrolRoute[i].position, king.aiController.patrolRoute[i + 1].position); + Gizmos.color = Color.cyan; + for (int i = 0; i < king.aiController.patrolRoute.Count - 1; i++) + { + Gizmos.DrawLine(king.aiController.patrolRoute[i].position, king.aiController.patrolRoute[i + 1].position); + } + Gizmos.DrawLine(king.aiController.patrolRoute[^1].position, king.aiController.patrolRoute[0].position); } - Gizmos.DrawLine(king.aiController.patrolRoute[^1].position, king.aiController.patrolRoute[0].position); } }