diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 7bbaf86..116fc9c 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -92,6 +92,7 @@ + diff --git a/Assets/Data/BuildingData_Core.asset b/Assets/Data/BuildingData_Core.asset index 231247a..0776ea4 100644 --- a/Assets/Data/BuildingData_Core.asset +++ b/Assets/Data/BuildingData_Core.asset @@ -14,12 +14,25 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::Northbound.BuildingData buildingName: BaseTower prefab: {fileID: 3733880183385667081, guid: 1979909431408184b9bc587877c5b4b4, type: 3} + icon: {fileID: 0} width: 5 length: 5 height: 5 placementOffset: {x: 0, y: 0, z: 0} allowRotation: 1 - maxHealth: 1000 + requiredWorkAmount: 100 + workPerInteraction: 10 + interactionCooldown: 1 + constructionAnimationTrigger: Build + constructionEquipment: + socketName: RightHand + equipmentPrefab: {fileID: 0} + attachOnStart: 1 + detachOnEnd: 1 + keepEquipped: 0 + attachDelay: 0 + detachDelay: 0 + maxHealth: 100 isIndestructible: 0 autoRegenerate: 0 regenPerSecond: 1 diff --git a/Assets/DefaultNetworkPrefabs.asset b/Assets/DefaultNetworkPrefabs.asset index 259c924..6b40698 100644 --- a/Assets/DefaultNetworkPrefabs.asset +++ b/Assets/DefaultNetworkPrefabs.asset @@ -59,3 +59,8 @@ MonoBehaviour: SourcePrefabToOverride: {fileID: 0} SourceHashToOverride: 0 OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} diff --git a/Assets/Materials/flatkit hexagons_medieval enemy.mat b/Assets/Materials/flatkit hexagons_medieval enemy.mat new file mode 100644 index 0000000..9b6ab45 --- /dev/null +++ b/Assets/Materials/flatkit hexagons_medieval enemy.mat @@ -0,0 +1,213 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4035507967926131752 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: flatkit hexagons_medieval enemy + m_Shader: {fileID: 4800000, guid: bee44b4a58655ee4cbff107302a3e131, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _CELPRIMARYMODE_SINGLE + - _DETAILMAPBLENDINGMODE_MULTIPLY + - _GRADIENTSPACE_WORLD + - _OUTLINESPACE_SCREEN + - _TEXTUREBLENDINGMODE_MULTIPLY + m_InvalidKeywords: + - _UNITYSHADOWMODE_NONE + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2000 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + - SRPDEFAULTUNLIT + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: b9dd7682e7a0a6041b2590e464add09c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _CelCurveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _CelStepTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: b9dd7682e7a0a6041b2590e464add09c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _BaseMapPremultiply: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _CameraDistanceImpact: 0.5 + - _CelExtraEnabled: 0 + - _CelNumSteps: 7 + - _CelPrimaryMode: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailMapBlendingMode: 0 + - _DetailMapImpact: 0 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _FlatRimEdgeSmoothness: 1 + - _FlatRimLightAlign: 0 + - _FlatRimSize: 0.1 + - _FlatSpecularEdgeSmoothness: 0 + - _FlatSpecularSize: 0 + - _Flatness: 1 + - _FlatnessExtra: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _GradientAngle: 0 + - _GradientCenterX: 0 + - _GradientCenterY: 0 + - _GradientEnabled: 0 + - _GradientSize: 10 + - _GradientSpace: 0 + - _LightContribution: 0 + - _LightFalloffSize: 0 + - _LightmapDirectionPitch: 0 + - _LightmapDirectionYaw: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _OutlineDepthOffset: 0.3 + - _OutlineEnabled: 0 + - _OutlineScale: 1 + - _OutlineSpace: 0 + - _OutlineWidth: 1 + - _OverrideLightmapDir: 0 + - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _RimEnabled: 0 + - _SelfShadingSize: 0.7 + - _SelfShadingSizeExtra: 0.464 + - _ShadowEdgeSize: 0.25 + - _ShadowEdgeSizeExtra: 0.124 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularEnabled: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _TextureBlendingMode: 0 + - _TextureImpact: 1 + - _UVSec: 0 + - _UnityShadowMode: 0 + - _UnityShadowOcclusion: 0 + - _UnityShadowPower: 0.2 + - _UnityShadowSharpness: 1 + - _VertexColorsEnabled: 0 + - _VertexExtrusionSmoothNormals: 0 + - _WorkflowMode: 1 + - _XRMotionVectorsPass: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 0, b: 0, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorDim: {r: 0, g: 0, b: 0, a: 1} + - _ColorDimCurve: {r: 1, g: 1, b: 1, a: 1} + - _ColorDimExtra: {r: 1, g: 0, b: 0, a: 1} + - _ColorDimSteps: {r: 0, g: 0, b: 0, a: 1} + - _ColorGradient: {r: 1, g: 1, b: 1, a: 1} + - _DetailMapColor: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _FlatRimColor: {r: 0, g: 0, b: 0, a: 1} + - _FlatSpecularColor: {r: 1, g: 1, b: 1, a: 1} + - _LightmapDirection: {r: 0, g: 1, b: 0, a: 0} + - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + - _UnityShadowColor: {r: 0.85023, g: 0.85034, b: 0.8504499, a: 0.85056} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/Materials/flatkit hexagons_medieval enemy.mat.meta b/Assets/Materials/flatkit hexagons_medieval enemy.mat.meta new file mode 100644 index 0000000..69e50ae --- /dev/null +++ b/Assets/Materials/flatkit hexagons_medieval enemy.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6a8d9e46e46bff3418a222db6f5786a5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/EnemyPortal.prefab b/Assets/Prefabs/EnemyPortal.prefab new file mode 100644 index 0000000..744ca03 --- /dev/null +++ b/Assets/Prefabs/EnemyPortal.prefab @@ -0,0 +1,127 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3432047510330746227 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 228462577495887354} + - component: {fileID: 6859825394817103090} + m_Layer: 0 + m_Name: EnemyPortal + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &228462577495887354 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3432047510330746227} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -19.4593, y: 1.00002, z: -58.8717} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1144932316349886388} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &6859825394817103090 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3432047510330746227} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cb91abd3aae74d941a739a48aefb74a1, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::EnemyPortal + Enemies: + - {fileID: 5176576196123937037, guid: 951b69041a2ace947afd721fefb3eaba, type: 3} +--- !u!1001 &606055883085645919 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 228462577495887354} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalScale.x + value: 10 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalScale.y + value: 10 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalScale.z + value: 10 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalRotation.x + value: 0.00000008146034 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -7511558181221131132, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: 'm_Materials.Array.data[0]' + value: + objectReference: {fileID: 2100000, guid: 6a8d9e46e46bff3418a222db6f5786a5, type: 2} + - target: {fileID: 919132149155446097, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_Name + value: wall_straight_gate + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} +--- !u!4 &1144932316349886388 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + m_PrefabInstance: {fileID: 606055883085645919} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/EnemyPortal.prefab.meta b/Assets/Prefabs/EnemyPortal.prefab.meta new file mode 100644 index 0000000..f8c2bdb --- /dev/null +++ b/Assets/Prefabs/EnemyPortal.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 11e3760dda2c0164abf759c18d918893 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Gate.prefab b/Assets/Prefabs/Gate.prefab index 5007636..b8672eb 100644 --- a/Assets/Prefabs/Gate.prefab +++ b/Assets/Prefabs/Gate.prefab @@ -9,7 +9,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 9184257640407244267} - m_Layer: 0 + m_Layer: 9 m_Name: FrontExitPoint m_TagString: Untagged m_Icon: {fileID: 0} @@ -40,7 +40,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1475778514072803484} - m_Layer: 0 + m_Layer: 9 m_Name: BackExitPoint m_TagString: Untagged m_Icon: {fileID: 0} @@ -78,8 +78,7 @@ GameObject: - component: {fileID: 6336968390548483685} - component: {fileID: 1893682255695519596} - component: {fileID: 2622677457934171119} - - component: {fileID: 2624539771375861302} - m_Layer: 0 + m_Layer: 9 m_Name: Gate m_TagString: Untagged m_Icon: {fileID: 0} @@ -137,7 +136,7 @@ NavMeshObstacle: m_Shape: 1 m_Extents: {x: 4, y: 4, z: 1.5} m_MoveThreshold: 0.1 - m_Carve: 0 + m_Carve: 1 m_CarveOnlyStationary: 1 m_Center: {x: 0, y: 0, z: 0} m_TimeToStationary: 0.5 @@ -205,7 +204,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Assembly-CSharp::Northbound.Building ShowTopMostFoldoutHeaderGroup: 1 - buildingData: {fileID: 0} + buildingData: {fileID: 11400000, guid: 0e495d169ee3bce449f4b1aea83d6818, type: 2} gridPosition: {x: 0, y: 0, z: 0} rotation: 0 initialTeam: 1 @@ -260,31 +259,6 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 8, y: 8, z: 1} m_Center: {x: 0, y: 0, z: 2} ---- !u!114 &2624539771375861302 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2998551506809628252} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 6eeb5dc026fdf4b488bc7ae0138ab719, type: 3} - m_Name: - m_EditorClassIdentifier: Unity.AI.Navigation::Unity.AI.Navigation.NavMeshLink - m_SerializedVersion: 1 - m_AgentTypeID: 0 - m_StartPoint: {x: 0, y: 0, z: -2.5} - m_EndPoint: {x: 0, y: 0, z: 2.5} - m_StartTransform: {fileID: 0} - m_EndTransform: {fileID: 0} - m_Activated: 1 - m_Width: 0 - m_CostModifier: 1 - m_IsOverridingCost: 0 - m_Bidirectional: 1 - m_AutoUpdatePosition: 0 - m_Area: 0 --- !u!1001 &665699090875585891 PrefabInstance: m_ObjectHideFlags: 0 @@ -349,10 +323,22 @@ PrefabInstance: propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 91e05bbf1e5cbfb4d865c8e2febc4673, type: 2} + - target: {fileID: -4677237296440866189, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} - target: {fileID: 919132149155446097, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} propertyPath: m_Name value: wall_straight_gate objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 1046628172763319773, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/Assets/Prefabs/MonsterTest.prefab b/Assets/Prefabs/MonsterTest.prefab index 5fc4c6a..21882f6 100644 --- a/Assets/Prefabs/MonsterTest.prefab +++ b/Assets/Prefabs/MonsterTest.prefab @@ -32,7 +32,7 @@ Transform: m_GameObject: {fileID: 5176576196123937037} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 1, z: -20.95} + m_LocalPosition: {x: 0, y: 1, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -107,7 +107,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3} m_Name: m_EditorClassIdentifier: Unity.Netcode.Runtime::Unity.Netcode.NetworkObject - GlobalObjectIdHash: 1957460564 + GlobalObjectIdHash: 1279840896 InScenePlacedSourceGlobalObjectIdHash: 0 DeferredDespawnTick: 0 Ownership: 1 @@ -148,7 +148,7 @@ NavMeshAgent: m_Enabled: 1 m_AgentTypeID: 0 m_Radius: 3.2048812 - m_Speed: 7.93 + m_Speed: 5 m_Acceleration: 8 avoidancePriority: 50 m_AngularSpeed: 120 @@ -174,20 +174,20 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::Northbound.EnemyAIController ShowTopMostFoldoutHeaderGroup: 1 aiType: 3 - detectionRange: 10 + detectionRange: 6 detectionAngle: 360 playerLayer: serializedVersion: 2 m_Bits: 512 obstacleLayer: serializedVersion: 2 - m_Bits: 4294967295 + m_Bits: 640 maxChaseDistance: 30 chaseGiveUpDistance: 25 attackRange: 5 attackInterval: 1.5 - attackDamage: 10 - moveSpeed: 3.5 + attackDamage: 50 + moveSpeed: 5 chaseSpeedMultiplier: 1.2 showDebugInfo: 1 --- !u!136 &795251864369751459 diff --git a/Assets/Prefabs/Wall.prefab b/Assets/Prefabs/Wall.prefab index 61f4bb2..0977e95 100644 --- a/Assets/Prefabs/Wall.prefab +++ b/Assets/Prefabs/Wall.prefab @@ -11,7 +11,9 @@ GameObject: - component: {fileID: 5749230937810543840} - component: {fileID: 4564973829688190844} - component: {fileID: 2599592318476693256} - m_Layer: 0 + - component: {fileID: 1907881863544148932} + - component: {fileID: 3214893598090363914} + m_Layer: 9 m_Name: Wall m_TagString: Untagged m_Icon: {fileID: 0} @@ -67,10 +69,61 @@ NavMeshObstacle: m_Shape: 1 m_Extents: {x: 4, y: 4, z: 1.5} m_MoveThreshold: 0.1 - m_Carve: 0 + m_Carve: 1 m_CarveOnlyStationary: 1 m_Center: {x: 0, y: 0, z: 0} - m_TimeToStationary: 0.5 + m_TimeToStationary: 0 +--- !u!114 &1907881863544148932 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 351020651857757465} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.Netcode.Runtime::Unity.Netcode.NetworkObject + GlobalObjectIdHash: 1061286994 + InScenePlacedSourceGlobalObjectIdHash: 1061286994 + DeferredDespawnTick: 0 + Ownership: 1 + AlwaysReplicateAsRoot: 0 + SynchronizeTransform: 1 + ActiveSceneSynchronization: 0 + SceneMigrationSynchronization: 0 + SpawnWithObservers: 1 + DontDestroyWithOwner: 0 + AutoObjectParentSync: 1 + SyncOwnerTransformWhenParented: 1 + AllowOwnerToParent: 0 +--- !u!114 &3214893598090363914 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 351020651857757465} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0ceedb9b012d848478813136b65738ae, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::Northbound.Building + ShowTopMostFoldoutHeaderGroup: 1 + buildingData: {fileID: 11400000, guid: 0e495d169ee3bce449f4b1aea83d6818, type: 2} + gridPosition: {x: 0, y: 0, z: 0} + rotation: 0 + initialTeam: 1 + initialOwnerId: 1 + useInitialOwner: 1 + showHealthBar: 1 + healthBarPrefab: {fileID: 0} + destroyEffectPrefab: {fileID: 0} + damageEffectPrefab: {fileID: 0} + effectSpawnPoint: {fileID: 0} + showGridBounds: 1 + gridBoundsColor: {r: 0, g: 1, b: 1, a: 1} --- !u!1001 &8926581783111832504 PrefabInstance: m_ObjectHideFlags: 0 @@ -139,6 +192,10 @@ PrefabInstance: propertyPath: m_Name value: wall_straight objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: 19a9a3527b4bd784f9c2c298374a843d, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/Assets/Scenes/GameMain.unity b/Assets/Scenes/GameMain.unity index 9547bb6..9a67b55 100644 --- a/Assets/Scenes/GameMain.unity +++ b/Assets/Scenes/GameMain.unity @@ -164,6 +164,14 @@ PrefabInstance: propertyPath: m_Name value: Wall (6) objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1907881863544148932, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: GlobalObjectIdHash + value: 1401823836 + objectReference: {fileID: 0} - target: {fileID: 5749230937810543840, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} propertyPath: m_LocalPosition.x value: 66 @@ -204,12 +212,8 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8965311896012452947, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8965311896012452947, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} - propertyPath: m_LocalPosition.z + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] @@ -222,6 +226,79 @@ Transform: m_CorrespondingSourceObject: {fileID: 5749230937810543840, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} m_PrefabInstance: {fileID: 97216554} m_PrefabAsset: {fileID: 0} +--- !u!1001 &182965999 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1988388203} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalScale.x + value: 10 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalScale.y + value: 10 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalScale.z + value: 10 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalRotation.x + value: 0.00000008146034 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -7511558181221131132, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: 'm_Materials.Array.data[0]' + value: + objectReference: {fileID: 2100000, guid: 6a8d9e46e46bff3418a222db6f5786a5, type: 2} + - target: {fileID: 919132149155446097, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + propertyPath: m_Name + value: wall_straight_gate + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} --- !u!1 &306979656 GameObject: m_ObjectHideFlags: 0 @@ -387,6 +464,22 @@ PrefabInstance: propertyPath: m_Name value: Wall (2) objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1907881863544148932, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: GlobalObjectIdHash + value: 1773363615 + objectReference: {fileID: 0} + - target: {fileID: 1907881863544148932, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: InScenePlacedSourceGlobalObjectIdHash + value: 1061286994 + objectReference: {fileID: 0} - target: {fileID: 5749230937810543840, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} propertyPath: m_LocalPosition.x value: 26 @@ -427,6 +520,14 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8965311896012452947, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -959,6 +1060,30 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 1068750869} m_Modifications: + - target: {fileID: 431325329827407922, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 431325329827407922, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 529351500009441178, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 529351500009441178, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 557134691980400830, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 557134691980400830, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} - target: {fileID: 2557322720114216881, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} propertyPath: GlobalObjectIdHash value: 4017687754 @@ -967,10 +1092,34 @@ PrefabInstance: propertyPath: InScenePlacedSourceGlobalObjectIdHash value: 1171432577 objectReference: {fileID: 0} + - target: {fileID: 2607013536690627895, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 2607013536690627895, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} - target: {fileID: 2998551506809628252, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} propertyPath: m_Name value: Gate (1) objectReference: {fileID: 0} + - target: {fileID: 2998551506809628252, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 2998551506809628252, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3902954835252584208, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 3902954835252584208, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7180212943015590733, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} propertyPath: m_LocalPosition.x value: 58 @@ -1297,6 +1446,18 @@ PrefabInstance: propertyPath: m_Name value: Wall (4) objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1907881863544148932, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: GlobalObjectIdHash + value: 844294403 + objectReference: {fileID: 0} - target: {fileID: 5749230937810543840, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} propertyPath: m_LocalPosition.x value: 42 @@ -1337,12 +1498,12 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8965311896012452947, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} - propertyPath: m_LocalPosition.x - value: 0 + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 objectReference: {fileID: 0} - - target: {fileID: 8965311896012452947, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} - propertyPath: m_LocalPosition.z + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] @@ -1523,7 +1684,7 @@ MonoBehaviour: m_LayerMask: serializedVersion: 2 m_Bits: 4294967295 - m_UseGeometry: 0 + m_UseGeometry: 1 m_DefaultArea: 0 m_GenerateLinks: 0 m_IgnoreNavMeshAgent: 1 @@ -1621,7 +1782,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1068750869} - m_Layer: 0 + m_Layer: 9 m_Name: Walls m_TagString: Untagged m_Icon: {fileID: 0} @@ -1954,7 +2115,7 @@ MonoBehaviour: m_DisconnectTimeoutMS: 30000 ConnectionData: Address: 127.0.0.1 - Port: 7790 + Port: 7834 ServerListenAddress: 127.0.0.1 ClientBindPort: 0 DebugSimulator: @@ -1976,6 +2137,81 @@ MonoBehaviour: spawnPoints: [] useRandomSpawn: 0 findSpawnPointsAutomatically: 1 +--- !u!1 &1442785552 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1442785555} + - component: {fileID: 1442785553} + - component: {fileID: 1442785554} + m_Layer: 0 + m_Name: GlobalTimer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1442785553 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1442785552} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.Netcode.Runtime::Unity.Netcode.NetworkObject + GlobalObjectIdHash: 3669992977 + InScenePlacedSourceGlobalObjectIdHash: 0 + DeferredDespawnTick: 0 + Ownership: 1 + AlwaysReplicateAsRoot: 0 + SynchronizeTransform: 1 + ActiveSceneSynchronization: 0 + SceneMigrationSynchronization: 0 + SpawnWithObservers: 1 + DontDestroyWithOwner: 0 + AutoObjectParentSync: 1 + SyncOwnerTransformWhenParented: 1 + AllowOwnerToParent: 0 +--- !u!114 &1442785554 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1442785552} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b643f7c446ade3f448e57e7501ac5a67, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::Northbound.GlobalTimer + ShowTopMostFoldoutHeaderGroup: 1 + cycleLength: 1 + autoStart: 1 + pauseOnZero: 1 + showDebugLogs: 1 +--- !u!4 &1442785555 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1442785552} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -20.15257, y: 1.00001, z: 4.73882} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1536695129 PrefabInstance: m_ObjectHideFlags: 0 @@ -2062,6 +2298,18 @@ PrefabInstance: propertyPath: m_Name value: Wall (5) objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1907881863544148932, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: GlobalObjectIdHash + value: 1658241711 + objectReference: {fileID: 0} - target: {fileID: 5749230937810543840, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} propertyPath: m_LocalPosition.x value: 50 @@ -2102,12 +2350,12 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8965311896012452947, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} - propertyPath: m_LocalPosition.x - value: 0 + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 objectReference: {fileID: 0} - - target: {fileID: 8965311896012452947, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} - propertyPath: m_LocalPosition.z + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] @@ -2202,6 +2450,11 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!4 &1577315389 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 15f5826a4fa224044bdf0c1c6bc4685b, type: 3} + m_PrefabInstance: {fileID: 182965999} + m_PrefabAsset: {fileID: 0} --- !u!1 &1672828972 GameObject: m_ObjectHideFlags: 0 @@ -2309,6 +2562,18 @@ PrefabInstance: propertyPath: m_Name value: Wall (3) objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1907881863544148932, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: GlobalObjectIdHash + value: 4240832885 + objectReference: {fileID: 0} - target: {fileID: 5749230937810543840, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} propertyPath: m_LocalPosition.x value: 34 @@ -2349,12 +2614,12 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8965311896012452947, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} - propertyPath: m_LocalPosition.x - value: 0 + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 objectReference: {fileID: 0} - - target: {fileID: 8965311896012452947, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} - propertyPath: m_LocalPosition.z + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] @@ -2550,6 +2815,18 @@ PrefabInstance: propertyPath: m_Name value: Wall (7) objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1907881863544148932, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: GlobalObjectIdHash + value: 1634476936 + objectReference: {fileID: 0} - target: {fileID: 5749230937810543840, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} propertyPath: m_LocalPosition.x value: 74 @@ -2590,12 +2867,12 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8965311896012452947, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} - propertyPath: m_LocalPosition.x - value: 0 + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 objectReference: {fileID: 0} - - target: {fileID: 8965311896012452947, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} - propertyPath: m_LocalPosition.z + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] @@ -2691,6 +2968,53 @@ PrefabInstance: insertIndex: -1 addedObject: {fileID: 985764489} m_SourcePrefab: {fileID: 100100000, guid: 19ca9afdd7bb3a64c9036c18e8cee5f2, type: 3} +--- !u!1 &1988388201 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1988388203} + - component: {fileID: 1988388202} + m_Layer: 0 + m_Name: EnemyPortal + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1988388202 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988388201} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cb91abd3aae74d941a739a48aefb74a1, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::EnemyPortal + Enemies: + - {fileID: 5176576196123937037, guid: 951b69041a2ace947afd721fefb3eaba, type: 3} +--- !u!4 &1988388203 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988388201} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -19.4593, y: 1.00002, z: -58.8717} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1577315389} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &2098115307 PrefabInstance: m_ObjectHideFlags: 0 @@ -2903,6 +3227,18 @@ PrefabInstance: propertyPath: m_Name value: Wall objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1907881863544148932, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: GlobalObjectIdHash + value: 379293221 + objectReference: {fileID: 0} - target: {fileID: 5749230937810543840, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} propertyPath: m_LocalPosition.x value: 2 @@ -2943,6 +3279,14 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -2969,6 +3313,18 @@ PrefabInstance: propertyPath: interactionAnimationTrigger value: objectReference: {fileID: 0} + - target: {fileID: 2236804103334722056, guid: e56926eda34629f4fbf3e4c53f0f8bd4, type: 3} + propertyPath: m_Size.x + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 2236804103334722056, guid: e56926eda34629f4fbf3e4c53f0f8bd4, type: 3} + propertyPath: m_Size.y + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 2236804103334722056, guid: e56926eda34629f4fbf3e4c53f0f8bd4, type: 3} + propertyPath: m_Size.z + value: 8 + objectReference: {fileID: 0} - target: {fileID: 5173262576415873253, guid: e56926eda34629f4fbf3e4c53f0f8bd4, type: 3} propertyPath: GlobalObjectIdHash value: 3998537868 @@ -3095,6 +3451,22 @@ PrefabInstance: propertyPath: m_Name value: Wall (1) objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 351020651857757465, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1907881863544148932, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: GlobalObjectIdHash + value: 649830493 + objectReference: {fileID: 0} + - target: {fileID: 1907881863544148932, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: InScenePlacedSourceGlobalObjectIdHash + value: 1061286994 + objectReference: {fileID: 0} - target: {fileID: 5749230937810543840, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} propertyPath: m_LocalPosition.x value: 10 @@ -3135,6 +3507,14 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 8584141298868924137, guid: 88f7f1e8a019b674498ab5fd494c1d34, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -3164,14 +3544,62 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 1068750869} m_Modifications: + - target: {fileID: 431325329827407922, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 431325329827407922, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 529351500009441178, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 529351500009441178, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 557134691980400830, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 557134691980400830, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} - target: {fileID: 2557322720114216881, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} propertyPath: GlobalObjectIdHash value: 2819059600 objectReference: {fileID: 0} + - target: {fileID: 2607013536690627895, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 2607013536690627895, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} - target: {fileID: 2998551506809628252, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} propertyPath: m_Name value: Gate objectReference: {fileID: 0} + - target: {fileID: 2998551506809628252, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 2998551506809628252, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3902954835252584208, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 3902954835252584208, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7180212943015590733, guid: 1be692ccde46d2a4baedc2ee75fbfbdb, type: 3} propertyPath: m_LocalPosition.x value: 18 @@ -3243,3 +3671,5 @@ SceneRoots: - {fileID: 1701756768} - {fileID: 2264374033617737844} - {fileID: 1572384099} + - {fileID: 1442785555} + - {fileID: 1988388203} diff --git a/Assets/Scenes/GameMain/NavMesh-Primitive_Floor.asset b/Assets/Scenes/GameMain/NavMesh-Primitive_Floor.asset index 35461e0..fd2ec95 100644 Binary files a/Assets/Scenes/GameMain/NavMesh-Primitive_Floor.asset and b/Assets/Scenes/GameMain/NavMesh-Primitive_Floor.asset differ diff --git a/Assets/Scripts/AttackAction.cs b/Assets/Scripts/AttackAction.cs index b779abb..6c8f5fd 100644 --- a/Assets/Scripts/AttackAction.cs +++ b/Assets/Scripts/AttackAction.cs @@ -174,8 +174,6 @@ namespace Northbound { DetachWeapon(); } - - Debug.Log("[AttackAction] 공격 완료"); } // ======================================== @@ -199,8 +197,6 @@ namespace Northbound string socket = socketName ?? equipmentData.socketName; _equipmentSocket.AttachToSocket(socket, equipmentData.equipmentPrefab); _isWeaponEquipped = true; - - Debug.Log($"[AttackAction] 무기 장착: {socket}"); } private void DetachWeapon(string socketName = null) @@ -214,8 +210,6 @@ namespace Northbound { _equipmentSocket.DetachFromSocket(socket); _isWeaponEquipped = false; - - Debug.Log($"[AttackAction] 무기 해제: {socket}"); } } diff --git a/Assets/Scripts/EnemyAIController.cs b/Assets/Scripts/EnemyAIController.cs index fa23c37..8b89cf0 100644 --- a/Assets/Scripts/EnemyAIController.cs +++ b/Assets/Scripts/EnemyAIController.cs @@ -1,6 +1,7 @@ using Unity.Netcode; using UnityEngine; using UnityEngine.AI; +using System.Collections; namespace Northbound { @@ -18,38 +19,38 @@ namespace Northbound [Header("Detection")] [Tooltip("플레이어 감지 범위")] public float detectionRange = 15f; - + [Tooltip("시야 각도 (0-360, 360=전방향)")] [Range(0, 360)] public float detectionAngle = 120f; - + [Tooltip("탐지할 레이어")] public LayerMask playerLayer = ~0; - + [Tooltip("시야 체크 장애물 레이어")] public LayerMask obstacleLayer = ~0; [Header("Chase Settings")] [Tooltip("추적 최대 거리 (이 거리 이상 추적하면 중단)")] public float maxChaseDistance = 30f; - + [Tooltip("추적 포기 거리 (플레이어와 이 거리 이상 멀어지면 추적 중단)")] public float chaseGiveUpDistance = 25f; [Header("Combat")] [Tooltip("공격 범위")] public float attackRange = 2f; - + [Tooltip("공격 간격 (초)")] public float attackInterval = 1.5f; - + [Tooltip("공격 데미지")] public int attackDamage = 10; [Header("Movement")] [Tooltip("이동 속도")] public float moveSpeed = 3.5f; - + [Tooltip("추적 중 속도 배율")] public float chaseSpeedMultiplier = 1.5f; @@ -66,6 +67,7 @@ namespace Northbound private float _lastAttackTime; private bool _hasSetCoreDestination; private float _lastDetectionLogTime; + private bool _isRecalculatingPath = false; // NavMesh 갱신 대기 플래그 private NetworkVariable _currentState = new NetworkVariable( EnemyAIState.Idle, @@ -100,17 +102,11 @@ namespace Northbound _agent.updateRotation = true; _agent.updateUpAxis = false; - // NavMesh 위에 있는지 확인 if (!_agent.isOnNavMesh) { Debug.LogWarning($"[EnemyAI] {gameObject.name}이(가) NavMesh 위에 있지 않습니다!"); } - else - { - Debug.Log($"[EnemyAI] {gameObject.name} NavMeshAgent 초기화 완료"); - } - // AI 타입에 따라 초기 상태 설정 if (aiType == TeamType.Monster) { FindCore(); @@ -130,21 +126,11 @@ namespace Northbound switch (_currentState.Value) { - case EnemyAIState.Idle: - UpdateIdle(); - break; - case EnemyAIState.MoveToCore: - UpdateMoveToCore(); - break; - case EnemyAIState.ChasePlayer: - UpdateChasePlayer(); - break; - case EnemyAIState.Attack: - UpdateAttack(); - break; - case EnemyAIState.ReturnToOrigin: - UpdateReturnToOrigin(); - break; + case EnemyAIState.Idle: UpdateIdle(); break; + case EnemyAIState.MoveToCore: UpdateMoveToCore(); break; + case EnemyAIState.ChasePlayer: UpdateChasePlayer(); break; + case EnemyAIState.Attack: UpdateAttack(); break; + case EnemyAIState.ReturnToOrigin: UpdateReturnToOrigin(); break; } } @@ -152,7 +138,7 @@ namespace Northbound private void UpdateIdle() { - GameObject player = DetectPlayer(); + GameObject player = DetectTarget(); if (player != null) { SetTargetPlayer(player); @@ -162,89 +148,67 @@ namespace Northbound private void UpdateMoveToCore() { - // 플레이어 감지 - GameObject player = DetectPlayer(); - if (player != null) + if (_isRecalculatingPath) return; // 코루틴 대기 중이면 중단 + if (_coreTransform == null) { FindCore(); return; } + + // 1. 코어로 가는 경로가 '완전(Complete)'한지 먼저 확인 + // NavMesh가 갱신되었다면 에이전트는 즉시 Complete 상태가 됩니다. + if (_agent.hasPath && _agent.pathStatus == NavMeshPathStatus.PathComplete) { - SetTargetPlayer(player); - TransitionToState(EnemyAIState.ChasePlayer); + if (!_hasSetCoreDestination) + { + _agent.SetDestination(_coreTransform.position); + _hasSetCoreDestination = true; + } + // [중요] 길이 열렸으므로 아래의 장애물 탐지 로직을 아예 실행하지 않고 리턴! return; } - // 코어가 없으면 찾기 - if (_coreTransform == null) - { - FindCore(); - _hasSetCoreDestination = false; - return; - } - - // 코어 표면까지의 실제 거리 계산 - float distanceToCore = GetDistanceToCoreSurface(); - - // 공격 범위 안에 있으면 공격 상태로 전환 - if (distanceToCore <= attackRange) + // 2. 코어 도달 확인 + if (GetDistanceToCoreSurface() <= attackRange) { TransitionToState(EnemyAIState.Attack); return; } - // 경로가 설정되지 않았거나 무효화된 경우에만 설정 - if (!_hasSetCoreDestination || !_agent.hasPath || _agent.pathStatus == NavMeshPathStatus.PathInvalid) + // 3. 길이 막혔을 때(Partial)만 아주 좁은 범위에서 장애물을 찾음 + GameObject obstacle = DetectObstacle(); + if (obstacle != null) { - if (_agent.SetDestination(_coreTransform.position)) - { - _hasSetCoreDestination = true; - - if (showDebugInfo) - { - Debug.Log($"[EnemyAI] {gameObject.name} 코어로 경로 설정 (표면 거리: {distanceToCore:F2}m, 공격범위: {attackRange:F2}m)"); - } - } - else - { - Debug.LogWarning($"[EnemyAI] {gameObject.name}이(가) 코어로 가는 경로를 찾을 수 없습니다!"); - _hasSetCoreDestination = false; - } + SetTargetPlayer(obstacle); + TransitionToState(EnemyAIState.Attack); + return; + } + + // 4. 경로가 유효하지 않을 때만 재설정 + if (!_agent.hasPath || _agent.pathStatus == NavMeshPathStatus.PathInvalid) + { + _agent.SetDestination(_coreTransform.position); + _hasSetCoreDestination = true; } } private void UpdateChasePlayer() { GameObject targetPlayer = GetTargetPlayer(); - - if (targetPlayer == null) - { - OnLostTarget(); - return; - } + if (targetPlayer == null) { OnLostTarget(); return; } float distanceToPlayer = Vector3.Distance(transform.position, targetPlayer.transform.position); - - // 추적 기준점 설정 Vector3 chaseReferencePoint = (aiType == TeamType.Monster) ? _chaseStartPosition : _originPosition; float distanceFromReference = Vector3.Distance(transform.position, chaseReferencePoint); - // 추적 중단 조건 확인 if (distanceToPlayer > chaseGiveUpDistance || distanceFromReference > maxChaseDistance) { - if (showDebugInfo) - { - string referenceType = (aiType == TeamType.Monster) ? "추적 시작" : "원점"; - Debug.Log($"[EnemyAI] {gameObject.name}이(가) 추적을 중단합니다. (플레이어 거리: {distanceToPlayer:F2}m, {referenceType} 거리: {distanceFromReference:F2}m)"); - } OnLostTarget(); return; } - // 공격 범위 확인 if (distanceToPlayer <= attackRange) { TransitionToState(EnemyAIState.Attack); return; } - // 플레이어 추적 - 매 프레임 업데이트 if (_agent.isOnNavMesh && !_agent.isStopped) { _agent.SetDestination(targetPlayer.transform.position); @@ -253,80 +217,48 @@ namespace Northbound private void UpdateAttack() { - // 코어 공격 중인지 확인 - bool attackingCore = _coreTransform != null && - GetDistanceToCoreSurface() <= attackRange * 1.2f; - - if (attackingCore) + GameObject target = GetTargetPlayer(); + if (target == null) { - float distanceToCore = GetDistanceToCoreSurface(); - - if (distanceToCore > attackRange * 1.2f) + if (showDebugInfo) Debug.Log("[EnemyAI] 타겟 상실 - 상태 해제"); + OnLostTarget(); + return; + } + + // 핵심: ClosestPoint를 사용해 '벽 표면'까지의 실제 거리 계산 + float distance = GetDistanceToTarget(target); + + // 코어 혹은 일반 타겟 공격 범위 체크 (공격 시 약간의 거리 여유 1.2f 부여) + if (distance <= attackRange * 1.2f) + { + // 타겟 바라보기 + Vector3 direction = (target.transform.position - transform.position).normalized; + direction.y = 0; + if (direction != Vector3.zero) { - TransitionToState(EnemyAIState.MoveToCore); - return; + transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(direction), Time.deltaTime * 5f); } - // 코어를 바라보기 - Vector3 directionToCore = (_coreTransform.position - transform.position).normalized; - directionToCore.y = 0; - if (directionToCore != Vector3.zero) + // 공격 실행 + if (Time.time - _lastAttackTime >= attackInterval) { - Quaternion targetRotation = Quaternion.LookRotation(directionToCore); - transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 5f); - } - - // 코어 공격 - IDamageable coreHealth = _coreTransform.GetComponent(); - if (coreHealth != null && Time.time - _lastAttackTime >= attackInterval) - { - coreHealth.TakeDamage(attackDamage, NetworkObjectId); - _lastAttackTime = Time.time; - Debug.Log($"[EnemyAI] {gameObject.name}이(가) 코어를 공격! (데미지: {attackDamage}, 표면 거리: {distanceToCore:F2}m)"); + AttackTarget(target); } } else { - // 플레이어 공격 - GameObject targetPlayer = GetTargetPlayer(); - - if (targetPlayer == null) - { - OnLostTarget(); - return; - } - - float distanceToPlayer = Vector3.Distance(transform.position, targetPlayer.transform.position); - - if (distanceToPlayer > attackRange * 1.2f) - { - TransitionToState(EnemyAIState.ChasePlayer); - return; - } - - // 플레이어를 바라보기 - Vector3 directionToPlayer = (targetPlayer.transform.position - transform.position).normalized; - directionToPlayer.y = 0; - if (directionToPlayer != Vector3.zero) - { - Quaternion targetRotation = Quaternion.LookRotation(directionToPlayer); - transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 5f); - } - - // 공격 - if (Time.time - _lastAttackTime >= attackInterval) - { - AttackPlayer(targetPlayer); - } + // 거리가 멀어지면 타겟 종류에 따라 상태 전환 + if (target == _coreTransform?.gameObject) TransitionToState(EnemyAIState.MoveToCore); + else TransitionToState(EnemyAIState.ChasePlayer); } } private void UpdateReturnToOrigin() { - GameObject player = DetectPlayer(); - if (player != null) + GameObject target = DetectTarget(); + if (target != null) { - SetTargetPlayer(player); + SetTargetPlayer(target); TransitionToState(EnemyAIState.ChasePlayer); return; } @@ -335,10 +267,6 @@ namespace Northbound { if (!_agent.hasPath || _agent.velocity.sqrMagnitude == 0f) { - if (showDebugInfo) - { - Debug.Log($"[EnemyAI] {gameObject.name}이(가) 원래 위치로 복귀했습니다."); - } TransitionToState(EnemyAIState.Idle); } } @@ -346,224 +274,71 @@ namespace Northbound #endregion - #region Detection + #region Detection & Target Management - private GameObject DetectPlayer() + private GameObject DetectTarget() { - Collider[] colliders = Physics.OverlapSphere(transform.position, detectionRange, playerLayer); + LayerMask targetMask = playerLayer | obstacleLayer; + Collider[] colliders = Physics.OverlapSphere(transform.position, detectionRange, targetMask); - GameObject closestPlayer = null; + GameObject closestTarget = null; float closestDistance = float.MaxValue; foreach (Collider col in colliders) { - // 자기 자신 제외 - if (col.transform.root == transform.root) - continue; + if (col.transform.root == transform.root) continue; + + IDamageable damageable = col.GetComponentInParent(); + if (damageable == null) continue; - // 플레이어 팀 확인 (부모에서 찾기) ITeamMember teamMember = col.GetComponentInParent(); - if (teamMember == null || teamMember.GetTeam() != TeamType.Player) - continue; + bool isAttackable = (teamMember != null && teamMember.GetTeam() == TeamType.Player) || (teamMember == null); + if (!isAttackable) continue; - // 플레이어 위치 (루트 오브젝트 사용) - Transform playerRoot = col.transform.root; - Vector3 playerPosition = playerRoot.position; - - // 거리 체크 - float distance = Vector3.Distance(transform.position, playerPosition); - if (distance > detectionRange) - continue; + float distance = Vector3.Distance(transform.position, col.transform.position); - // 시야각 확인 (360도면 모든 방향 감지) if (detectionAngle < 360f) { - Vector3 directionToTarget = (playerPosition - transform.position).normalized; - float angleToTarget = Vector3.Angle(transform.forward, directionToTarget); - - if (angleToTarget > detectionAngle / 2f) - continue; + Vector3 directionToTarget = (col.transform.position - transform.position).normalized; + if (Vector3.Angle(transform.forward, directionToTarget) > detectionAngle / 2f) continue; } - // 시야 체크 (레이캐스트) - 플레이어 중심으로 - Vector3 rayStart = transform.position + Vector3.up * 1f; // 적의 눈 높이 - Vector3 rayTarget = playerPosition + Vector3.up * 1f; // 플레이어 중심 - Vector3 rayDirection = (rayTarget - rayStart).normalized; - float rayDistance = Vector3.Distance(rayStart, rayTarget); - - bool lineOfSight = true; - - // 장애물 체크 (옵션) - if (Physics.Raycast(rayStart, rayDirection, out RaycastHit hit, rayDistance, obstacleLayer)) + if (distance < closestDistance) { - // 맞은 오브젝트가 플레이어의 루트나 자식인지 확인 - if (hit.transform.root != playerRoot) - { - lineOfSight = false; - } + closestDistance = distance; + // 부모(Walls)가 아닌 실제 콜라이더가 있는 자식(wall)을 잡음 + closestTarget = col.gameObject; } + } + return closestTarget; + } - if (lineOfSight) + public GameObject DetectObstacle() + { + RaycastHit hit; + Vector3 origin = transform.position + Vector3.up * 1.0f; + Vector3 direction = transform.forward; + float castDistance = attackRange * 1.5f; + + if (Physics.SphereCast(origin, 0.5f, direction, out hit, castDistance, obstacleLayer)) + { + if (hit.collider.GetComponentInParent() != null) { - // 가장 가까운 플레이어 찾기 - if (distance < closestDistance) - { - closestDistance = distance; - closestPlayer = playerRoot.gameObject; - } + // hit.collider.gameObject를 반환함으로써 자식 오브젝트를 직접 타겟팅함 + return hit.collider.gameObject; } } - - // 감지 성공 시 로그 (1초에 한 번만) - if (closestPlayer != null && showDebugInfo && Time.time - _lastDetectionLogTime >= 1f) - { - string angleInfo = detectionAngle >= 360f ? "전방향" : $"{Vector3.Angle(transform.forward, (closestPlayer.transform.position - transform.position).normalized):F1}°"; - Debug.Log($"[EnemyAI] {gameObject.name}이(가) {closestPlayer.name}을(를) 감지! (거리: {closestDistance:F2}m, 각도: {angleInfo})"); - _lastDetectionLogTime = Time.time; - } - - return closestPlayer; + return null; } - #endregion - - #region Combat - - private void AttackPlayer(GameObject player) + private void SetTargetPlayer(GameObject target) { - IDamageable damageable = player.GetComponentInParent(); - if (damageable != null) - { - damageable.TakeDamage(attackDamage, NetworkObjectId); - _lastAttackTime = Time.time; + if (target == null) return; + _cachedTargetPlayer = target; - if (showDebugInfo) - { - Debug.Log($"[EnemyAI] {gameObject.name}이(가) {player.name}을(를) 공격! (데미지: {attackDamage})"); - } - } - } - - #endregion - - #region Distance Calculation - - private float GetDistanceToCoreSurface() - { - if (_coreTransform == null) - return float.MaxValue; - - if (_coreCollider != null) - { - Vector3 closestPoint = _coreCollider.ClosestPoint(transform.position); - float distanceToSurface = Vector3.Distance(transform.position, closestPoint); - return distanceToSurface; - } - else - { - return Vector3.Distance(transform.position, _coreTransform.position); - } - } - - #endregion - - #region State Management - - private void TransitionToState(EnemyAIState newState) - { - if (_currentState.Value == newState) return; - - if (showDebugInfo) - { - Debug.Log($"[EnemyAI] {gameObject.name} 상태 변경: {_currentState.Value} → {newState}"); - } - - OnExitState(_currentState.Value); - _currentState.Value = newState; - OnEnterState(newState); - } - - private void OnEnterState(EnemyAIState state) - { - switch (state) - { - case EnemyAIState.Idle: - _agent.isStopped = true; - _agent.speed = moveSpeed; - _agent.ResetPath(); - break; - - case EnemyAIState.MoveToCore: - _agent.isStopped = false; - _agent.speed = moveSpeed; - _hasSetCoreDestination = false; - - if (showDebugInfo) - { - Debug.Log($"[EnemyAI] {gameObject.name}이(가) 코어로 이동 시작"); - } - break; - - case EnemyAIState.ChasePlayer: - _agent.isStopped = false; - _agent.speed = moveSpeed * chaseSpeedMultiplier; - _chaseStartPosition = transform.position; - - if (showDebugInfo) - { - Debug.Log($"[EnemyAI] {gameObject.name}이(가) 추적 시작! (시작 위치: {_chaseStartPosition})"); - } - break; - - case EnemyAIState.Attack: - _agent.isStopped = true; - _agent.ResetPath(); - break; - - case EnemyAIState.ReturnToOrigin: - _agent.isStopped = false; - _agent.speed = moveSpeed; - _agent.stoppingDistance = 1f; - _agent.SetDestination(_originPosition); - ClearTargetPlayer(); - break; - } - } - - private void OnExitState(EnemyAIState state) - { - if (state == EnemyAIState.ReturnToOrigin) - { - _agent.stoppingDistance = attackRange * 0.7f; - } - } - - private void OnLostTarget() - { - if (aiType == TeamType.Hostile) - { - TransitionToState(EnemyAIState.ReturnToOrigin); - } - else if (aiType == TeamType.Monster) - { - ClearTargetPlayer(); - _hasSetCoreDestination = false; - TransitionToState(EnemyAIState.MoveToCore); - } - } - - #endregion - - #region Target Management - - private void SetTargetPlayer(GameObject player) - { - var networkObject = player.GetComponentInParent(); - if (networkObject != null) - { - _targetPlayerId.Value = networkObject.NetworkObjectId; - _cachedTargetPlayer = player; - } + var networkObject = target.GetComponentInParent(); + if (networkObject != null) _targetPlayerId.Value = networkObject.NetworkObjectId; + else _targetPlayerId.Value = 0; } private void ClearTargetPlayer() @@ -574,17 +349,23 @@ namespace Northbound private GameObject GetTargetPlayer() { - if (_targetPlayerId.Value == 0) return null; + // 1순위: 물리적 참조 (장애물/서버 전용) + if (_cachedTargetPlayer != null && _cachedTargetPlayer.activeInHierarchy) return _cachedTargetPlayer; - if (_cachedTargetPlayer != null && _cachedTargetPlayer.activeSelf) + // 2순위: 네트워크 ID 검색 + if (_targetPlayerId.Value != 0) { - return _cachedTargetPlayer; + if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(_targetPlayerId.Value, out NetworkObject networkObject)) + { + _cachedTargetPlayer = networkObject.gameObject; + return _cachedTargetPlayer; + } } - if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(_targetPlayerId.Value, out NetworkObject networkObject)) + // 3순위: 코어 확인 + if (_currentState.Value == EnemyAIState.Attack && _coreTransform != null) { - _cachedTargetPlayer = networkObject.gameObject; - return _cachedTargetPlayer; + if (GetDistanceToCoreSurface() <= attackRange * 1.5f) return _coreTransform.gameObject; } return null; @@ -592,7 +373,122 @@ namespace Northbound #endregion - #region Utilities + #region Combat Logic + + private void AttackTarget(GameObject target) + { + // 1. 타겟의 자식, 본인, 부모 순으로 샅샅이 뒤져서 IDamageable을 찾습니다. + IDamageable damageable = target.GetComponentInChildren(); + if (damageable == null) damageable = target.GetComponent(); + if (damageable == null) damageable = target.GetComponentInParent(); + + if (damageable != null) + { + // 2. 공격 쿨타임 체크 + if (Time.time - _lastAttackTime >= attackInterval) + { + damageable.TakeDamage(attackDamage, NetworkObjectId); + _lastAttackTime = Time.time; + + if (showDebugInfo) + Debug.Log($"[EnemyAI] {gameObject.name} -> {target.name} 타격 성공! (데미지: {attackDamage})"); + } + } + else + { + // 3. 만약 IDamageable을 못 찾았다면 로그를 남겨서 범인을 찾습니다. + if (showDebugInfo) + Debug.LogWarning($"[EnemyAI] {target.name}에 IDamageable 스크립트가 없습니다!"); + + // 공격할 수 없는 대상이면 상태를 해제합니다. + OnLostTarget(); + } + } + + #endregion + + #region Utilities & Distance + + private float GetDistanceToTarget(GameObject target) + { + if (target == _coreTransform?.gameObject) return GetDistanceToCoreSurface(); + + Collider col = target.GetComponent(); + if (col != null) + { + return Vector3.Distance(transform.position, col.ClosestPoint(transform.position)); + } + return Vector3.Distance(transform.position, target.transform.position); + } + + private float GetDistanceToCoreSurface() + { + if (_coreTransform == null) return float.MaxValue; + if (_coreCollider != null) + { + Vector3 closestPoint = _coreCollider.ClosestPoint(transform.position); + return Vector3.Distance(transform.position, closestPoint); + } + return Vector3.Distance(transform.position, _coreTransform.position); + } + + private void TransitionToState(EnemyAIState newState) + { + if (_currentState.Value == newState) return; + OnExitState(_currentState.Value); + _currentState.Value = newState; + OnEnterState(newState); + } + + private void OnEnterState(EnemyAIState state) + { + switch (state) + { + case EnemyAIState.Idle: + case EnemyAIState.Attack: + _agent.isStopped = true; + _agent.ResetPath(); + break; + case EnemyAIState.MoveToCore: + case EnemyAIState.ChasePlayer: + case EnemyAIState.ReturnToOrigin: + _agent.isStopped = false; + _agent.speed = (state == EnemyAIState.ChasePlayer) ? moveSpeed * chaseSpeedMultiplier : moveSpeed; + if (state == EnemyAIState.ChasePlayer) _chaseStartPosition = transform.position; + if (state == EnemyAIState.ReturnToOrigin) _agent.SetDestination(_originPosition); + break; + } + } + + private void OnExitState(EnemyAIState state) { } + + private void OnLostTarget() + { + ClearTargetPlayer(); + + if (IsServer && _agent.isOnNavMesh) + { + // 1. 현재 가던 길을 즉시 멈춤 + _agent.ResetPath(); + _hasSetCoreDestination = false; + + // 2. NavMesh가 채워질 시간을 벌기 위한 코루틴 시작 + StartCoroutine(WaitAndRepathRoutine()); + } + } + + private IEnumerator WaitAndRepathRoutine() + { + _isRecalculatingPath = true; + + // NavMesh 바닥이 채워지는 시간을 기다림 (0.15~0.2초 권장) + yield return new WaitForSeconds(0.2f); + + _isRecalculatingPath = false; + + // 코어로 다시 이동 상태 전환 + TransitionToState(aiType == TeamType.Monster ? EnemyAIState.MoveToCore : EnemyAIState.Idle); + } private void FindCore() { @@ -600,115 +496,29 @@ namespace Northbound if (core != null) { _coreTransform = core.transform; - - _coreCollider = core.GetComponent(); - if (_coreCollider == null) - { - _coreCollider = core.GetComponentInChildren(); - } - - if (_coreCollider != null) - { - Debug.Log($"[EnemyAI] {gameObject.name}이(가) 코어를 찾았습니다! (위치: {_coreTransform.position}, Collider: {_coreCollider.GetType().Name})"); - } - else - { - Debug.LogWarning($"[EnemyAI] {gameObject.name}이(가) 코어를 찾았지만 Collider가 없습니다."); - } - } - else - { - Debug.LogWarning($"[EnemyAI] {gameObject.name}이(가) 코어를 찾을 수 없습니다!"); + _coreCollider = core.GetComponent() ?? core.GetComponentInChildren(); } } #endregion - #region Gizmos - + #region Gizmos (기존 코드 유지) private void OnDrawGizmos() { if (!showDebugInfo) return; + Gizmos.color = Color.yellow; Gizmos.DrawWireSphere(transform.position, detectionRange); + Gizmos.color = Color.red; Gizmos.DrawWireSphere(transform.position, attackRange); - // 감지 범위 - Gizmos.color = Color.yellow; - Gizmos.DrawWireSphere(transform.position, detectionRange); - - // 공격 범위 - Gizmos.color = Color.red; - Gizmos.DrawWireSphere(transform.position, attackRange); - - // 시야각 (360도가 아닐 때만 표시) if (detectionAngle < 360f) { Vector3 forward = transform.forward * detectionRange; - Vector3 leftBoundary = Quaternion.Euler(0, -detectionAngle / 2f, 0) * forward; - Vector3 rightBoundary = Quaternion.Euler(0, detectionAngle / 2f, 0) * forward; - + Vector3 left = Quaternion.Euler(0, -detectionAngle / 2f, 0) * forward; + Vector3 right = Quaternion.Euler(0, detectionAngle / 2f, 0) * forward; Gizmos.color = Color.blue; - Gizmos.DrawLine(transform.position, transform.position + leftBoundary); - Gizmos.DrawLine(transform.position, transform.position + rightBoundary); - } - - // 원점 표시 (적대 세력만) - if (aiType == TeamType.Hostile && Application.isPlaying) - { - Gizmos.color = Color.green; - Gizmos.DrawWireSphere(_originPosition, 1f); - Gizmos.DrawLine(transform.position, _originPosition); - } - - // 추적 시작 위치 표시 - if (Application.isPlaying && (_currentState.Value == EnemyAIState.ChasePlayer || _currentState.Value == EnemyAIState.Attack)) - { - Gizmos.color = Color.cyan; - Gizmos.DrawWireSphere(_chaseStartPosition, 1.5f); - Gizmos.DrawLine(transform.position, _chaseStartPosition); - } - - // 코어 방향 및 표면까지의 거리 표시 - if (Application.isPlaying && _currentState.Value == EnemyAIState.MoveToCore && _coreTransform != null) - { - Gizmos.color = Color.magenta; - Gizmos.DrawLine(transform.position, _coreTransform.position); - Gizmos.DrawWireSphere(_coreTransform.position, 2f); - - if (_coreCollider != null) - { - Vector3 closestPoint = _coreCollider.ClosestPoint(transform.position); - Gizmos.color = Color.green; - Gizmos.DrawLine(transform.position, closestPoint); - Gizmos.DrawWireSphere(closestPoint, 0.5f); - } + Gizmos.DrawLine(transform.position, transform.position + left); + Gizmos.DrawLine(transform.position, transform.position + right); } } - - private void OnDrawGizmosSelected() - { - OnDrawGizmos(); - - #if UNITY_EDITOR - if (Application.isPlaying && _agent != null) - { - string pathInfo = _agent.hasPath ? $"Path: {_agent.path.status}" : "No Path"; - string navMeshInfo = _agent.isOnNavMesh ? "On NavMesh" : "OFF NAVMESH!"; - string velocityInfo = $"Velocity: {_agent.velocity.magnitude:F2}"; - - string distanceInfo = ""; - if (_coreTransform != null && _currentState.Value == EnemyAIState.MoveToCore) - { - float surfaceDistance = GetDistanceToCoreSurface(); - distanceInfo = $"\nCore Surface Dist: {surfaceDistance:F2}m"; - } - - string angleInfo = detectionAngle >= 360f ? "\nDetection: 360° (전방향)" : $"\nDetection: {detectionAngle}°"; - - UnityEditor.Handles.Label(transform.position + Vector3.up * 3f, - $"Enemy AI\nState: {_currentState.Value}\nType: {aiType}\n{navMeshInfo}\n{pathInfo}\n{velocityInfo}{angleInfo}\nRange: {detectionRange}m\nAttack: {attackRange}m{distanceInfo}"); - } - #endif - } - #endregion } } \ No newline at end of file diff --git a/Assets/Scripts/EnemyPortal.cs b/Assets/Scripts/EnemyPortal.cs new file mode 100644 index 0000000..4f9e72d --- /dev/null +++ b/Assets/Scripts/EnemyPortal.cs @@ -0,0 +1,35 @@ +using Northbound; +using System.Collections.Generic; +using Unity.Netcode; +using UnityEngine; +using static Northbound.ObstacleSpawner; +using static UnityEditor.FilePathAttribute; + +public class EnemyPortal : MonoBehaviour +{ + [Header("Spawn Settings")] + [Tooltip("소환할 몬스터 목록")] + [SerializeField] private List Enemies = new(); + + // Start is called once before the first execution of Update after the MonoBehaviour is created + void Start() + { + GlobalTimer.Instance.OnCycleComplete += SpawnEnemy; + } + + private void SpawnEnemy() + { + foreach (GameObject obj in Enemies) + { + GameObject enemy = Instantiate(obj, transform); + enemy.GetComponent().Spawn(); + Debug.Log(enemy); + } + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Scripts/EnemyPortal.cs.meta b/Assets/Scripts/EnemyPortal.cs.meta new file mode 100644 index 0000000..1b377ef --- /dev/null +++ b/Assets/Scripts/EnemyPortal.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cb91abd3aae74d941a739a48aefb74a1 \ No newline at end of file