From 742da94fe9bf1e5e1dad989dbda3b1f0752db95a Mon Sep 17 00:00:00 2001 From: Daniel Lovell Date: Thu, 12 Sep 2024 10:36:45 -0700 Subject: [PATCH] Reorganization and many improvements of rendering --- .gitignore | 5 + Assets/Materials/DroneTargetMat.mat | 4 +- Assets/Materials/HitMarkerMat.mat | 85 +++++ Assets/Materials/HitMarkerMat.mat.meta | 8 + Assets/Materials/MicromissileMat.mat | 4 +- Assets/Meshes.meta | 8 + Assets/Meshes/ConeMesh.asset | 167 +++++++++ Assets/Meshes/ConeMesh.asset.meta | 8 + Assets/Models.meta | 8 + Assets/Resources/Prefabs/DroneTarget.prefab | 206 ++++++++++- .../Resources/Prefabs/HitMarkerPrefab.prefab | 85 +++++ .../Prefabs/HitMarkerPrefab.prefab.meta | 7 + Assets/Resources/Prefabs/Micromissile.prefab | 101 +++++- Assets/Scenes/MainScene.unity | 329 +++++++++++++++++- Assets/Scripts/Agent.cs | 20 +- Assets/Scripts/Assignment.meta | 8 + Assets/Scripts/{ => Assignment}/Assignment.cs | 0 .../{ => Assignment}/Assignment.cs.meta | 0 .../{ => Assignment}/RoundRobinAssignment.cs | 0 .../RoundRobinAssignment.cs.meta | 0 Assets/Scripts/Assignment/ThreatAssignment.cs | 74 ++++ .../Assignment/ThreatAssignment.cs.meta | 11 + Assets/Scripts/Config.meta | 8 + .../Scripts/{ => Config}/SimulationConfig.cs | 0 .../{ => Config}/SimulationConfig.cs.meta | 0 Assets/Scripts/{ => Config}/StaticConfig.cs | 0 .../Scripts/{ => Config}/StaticConfig.cs.meta | 0 Assets/Scripts/Editor.meta | 8 + Assets/Scripts/Editor/GenerateCone.cs | 157 +++++++++ Assets/Scripts/Editor/GenerateCone.cs.meta | 11 + Assets/Scripts/Interceptors.meta | 8 + .../{ => Interceptors}/Micromissile.cs | 18 +- .../{ => Interceptors}/Micromissile.cs.meta | 0 Assets/Scripts/Missile.cs | 11 + Assets/Scripts/Sensors.meta | 8 + Assets/Scripts/{ => Sensors}/IdealSensor.cs | 0 .../Scripts/{ => Sensors}/IdealSensor.cs.meta | 0 Assets/Scripts/{ => Sensors}/Sensor.cs | 0 Assets/Scripts/{ => Sensors}/Sensor.cs.meta | 0 Assets/Scripts/SimManager.cs | 6 +- Assets/Scripts/Targets.meta | 8 + Assets/Scripts/{ => Targets}/DroneTarget.cs | 0 .../Scripts/{ => Targets}/DroneTarget.cs.meta | 0 Assets/Scripts/{ => Targets}/MissileTarget.cs | 0 .../{ => Targets}/MissileTarget.cs.meta | 0 Assets/Scripts/{ => Targets}/Target.cs | 0 Assets/Scripts/{ => Targets}/Target.cs.meta | 0 Assets/SimulationConfigMany.asset | 109 ++++++ Assets/SimulationConfigMany.asset.meta | 8 + 49 files changed, 1434 insertions(+), 64 deletions(-) create mode 100644 Assets/Materials/HitMarkerMat.mat create mode 100644 Assets/Materials/HitMarkerMat.mat.meta create mode 100644 Assets/Meshes.meta create mode 100644 Assets/Meshes/ConeMesh.asset create mode 100644 Assets/Meshes/ConeMesh.asset.meta create mode 100644 Assets/Models.meta create mode 100644 Assets/Resources/Prefabs/HitMarkerPrefab.prefab create mode 100644 Assets/Resources/Prefabs/HitMarkerPrefab.prefab.meta create mode 100644 Assets/Scripts/Assignment.meta rename Assets/Scripts/{ => Assignment}/Assignment.cs (100%) rename Assets/Scripts/{ => Assignment}/Assignment.cs.meta (100%) rename Assets/Scripts/{ => Assignment}/RoundRobinAssignment.cs (100%) rename Assets/Scripts/{ => Assignment}/RoundRobinAssignment.cs.meta (100%) create mode 100644 Assets/Scripts/Assignment/ThreatAssignment.cs create mode 100644 Assets/Scripts/Assignment/ThreatAssignment.cs.meta create mode 100644 Assets/Scripts/Config.meta rename Assets/Scripts/{ => Config}/SimulationConfig.cs (100%) rename Assets/Scripts/{ => Config}/SimulationConfig.cs.meta (100%) rename Assets/Scripts/{ => Config}/StaticConfig.cs (100%) rename Assets/Scripts/{ => Config}/StaticConfig.cs.meta (100%) create mode 100644 Assets/Scripts/Editor.meta create mode 100644 Assets/Scripts/Editor/GenerateCone.cs create mode 100644 Assets/Scripts/Editor/GenerateCone.cs.meta create mode 100644 Assets/Scripts/Interceptors.meta rename Assets/Scripts/{ => Interceptors}/Micromissile.cs (88%) rename Assets/Scripts/{ => Interceptors}/Micromissile.cs.meta (100%) create mode 100644 Assets/Scripts/Sensors.meta rename Assets/Scripts/{ => Sensors}/IdealSensor.cs (100%) rename Assets/Scripts/{ => Sensors}/IdealSensor.cs.meta (100%) rename Assets/Scripts/{ => Sensors}/Sensor.cs (100%) rename Assets/Scripts/{ => Sensors}/Sensor.cs.meta (100%) create mode 100644 Assets/Scripts/Targets.meta rename Assets/Scripts/{ => Targets}/DroneTarget.cs (100%) rename Assets/Scripts/{ => Targets}/DroneTarget.cs.meta (100%) rename Assets/Scripts/{ => Targets}/MissileTarget.cs (100%) rename Assets/Scripts/{ => Targets}/MissileTarget.cs.meta (100%) rename Assets/Scripts/{ => Targets}/Target.cs (100%) rename Assets/Scripts/{ => Targets}/Target.cs.meta (100%) create mode 100644 Assets/SimulationConfigMany.asset create mode 100644 Assets/SimulationConfigMany.asset.meta diff --git a/.gitignore b/.gitignore index 58cbc82..ea8c50b 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,8 @@ crashlytics-build.properties # Temporary auto-generated Android Assets /[Aa]ssets/[Ss]treamingAssets/aa.meta /[Aa]ssets/[Ss]treamingAssets/aa/* + +# IDE related files +.vscode/ +.vsconfig + diff --git a/Assets/Materials/DroneTargetMat.mat b/Assets/Materials/DroneTargetMat.mat index 90668bb..782e275 100644 --- a/Assets/Materials/DroneTargetMat.mat +++ b/Assets/Materials/DroneTargetMat.mat @@ -66,9 +66,9 @@ Material: - _DetailNormalMapScale: 1 - _DstBlend: 0 - _GlossMapScale: 1 - - _Glossiness: 0.5 + - _Glossiness: 0.306 - _GlossyReflections: 1 - - _Metallic: 0 + - _Metallic: 0.569 - _Mode: 0 - _OcclusionStrength: 1 - _Parallax: 0.02 diff --git a/Assets/Materials/HitMarkerMat.mat b/Assets/Materials/HitMarkerMat.mat new file mode 100644 index 0000000..1682033 --- /dev/null +++ b/Assets/Materials/HitMarkerMat.mat @@ -0,0 +1,85 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: HitMarkerMat + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + 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} + - _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: 0} + 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} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _GlossMapScale: 1 + - _Glossiness: 0.523 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 3 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 0 + m_Colors: + - _Color: {r: 1, g: 0, b: 0, a: 0.35686275} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Materials/HitMarkerMat.mat.meta b/Assets/Materials/HitMarkerMat.mat.meta new file mode 100644 index 0000000..5c0c533 --- /dev/null +++ b/Assets/Materials/HitMarkerMat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e95a32c351775244582551eee20b59e6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/MicromissileMat.mat b/Assets/Materials/MicromissileMat.mat index 36b07c4..510a557 100644 --- a/Assets/Materials/MicromissileMat.mat +++ b/Assets/Materials/MicromissileMat.mat @@ -66,9 +66,9 @@ Material: - _DetailNormalMapScale: 1 - _DstBlend: 0 - _GlossMapScale: 1 - - _Glossiness: 0.5 + - _Glossiness: 0.192 - _GlossyReflections: 1 - - _Metallic: 0 + - _Metallic: 0.7 - _Mode: 0 - _OcclusionStrength: 1 - _Parallax: 0.02 diff --git a/Assets/Meshes.meta b/Assets/Meshes.meta new file mode 100644 index 0000000..35a86de --- /dev/null +++ b/Assets/Meshes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9e94c061dd849614896c325fcca9f294 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Meshes/ConeMesh.asset b/Assets/Meshes/ConeMesh.asset new file mode 100644 index 0000000..26347d7 --- /dev/null +++ b/Assets/Meshes/ConeMesh.asset @@ -0,0 +1,167 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!43 &4300000 +Mesh: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ConeMesh + serializedVersion: 11 + m_SubMeshes: + - serializedVersion: 2 + firstByte: 0 + indexCount: 90 + topology: 0 + baseVertex: 0 + firstVertex: 0 + vertexCount: 90 + localAABB: + m_Center: {x: -0.112802714, y: 0.64444447, z: 0} + m_Extent: {x: 1, y: 1, z: 1} + m_Shapes: + vertices: [] + shapes: [] + channels: [] + fullWeights: [] + m_BindPose: [] + m_BoneNameHashes: + m_RootBoneNameHash: 0 + m_BonesAABB: [] + m_VariableBoneCountWeights: + m_Data: + m_MeshCompression: 0 + m_IsReadable: 1 + m_KeepVertices: 1 + m_KeepIndices: 1 + m_IndexFormat: 0 + m_IndexBuffer: 00000100020003000400050006000700080009000a000b000c000d000e000f0010001100120013001400150016001700180019001a001b001c001d001e001f0020002100220023002400250026002700280029002a002b002c002d002e002f0030003100320033003400350036003700380039003a003b003c003d003e003f0040004100420043004400450046004700480049004a004b004c004d004e004f005000510052005300540055005600570058005900 + m_VertexData: + serializedVersion: 3 + m_VertexCount: 90 + m_Channels: + - stream: 0 + offset: 0 + format: 0 + dimension: 3 + - stream: 0 + offset: 12 + format: 0 + dimension: 3 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + - stream: 0 + offset: 0 + format: 0 + dimension: 0 + m_DataSize: 2160 + _typelessdata: 1b05e7bd287dd23f832dd831ee6e613fee6ee13eb05d333ebba24f3f600bb6be16efc33eee6e613fee6ee13eb05d333e5d1f633f600bb6be832dd831ee6e613fee6ee13eb05d333e1b05e7bd287dd23f832dd831f81c3f3fef6ee13e3d65ff3e5024183f600bb6bef304353ff81c3f3fef6ee13e3d65ff3ebba24f3f600bb6be16efc33ef81c3f3fef6ee13e3d65ff3e1b05e7bd287dd23f832dd8313d65ff3eef6ee13ef91c3f3fce2d8a3e600bb6be5e836c3f3d65ff3eef6ee13ef91c3f3f5024183f600bb6bef304353f3d65ff3eef6ee13ef91c3f3f1b05e7bd287dd23f832dd831b05d333eee6ee13eee6e613f2105e7bd600bb6be0000803fb05d333eee6ee13eee6e613fce2d8a3e600bb6be5e836c3fb05d333eee6ee13eee6e613f1b05e7bd287dd23f832dd831b05d33bef06ee13eee6e613f5fb0fdbe600bb6be5e836c3fb05d33bef06ee13eee6e613f2105e7bd600bb6be0000803fb05d33bef06ee13eee6e613f1b05e7bd287dd23f832dd8314065ffbef06ee13ef81c3f3f96e551bf600bb6bef304353f4065ffbef06ee13ef81c3f3f5fb0fdbe600bb6be5e836c3f4065ffbef06ee13ef81c3f3f1b05e7bd287dd23f832dd831f71c3fbfef6ee13e4065ff3e02b284bf600bb6be10efc33ef71c3fbfef6ee13e4065ff3e96e551bf600bb6bef304353ff71c3fbfef6ee13e4065ff3e1b05e7bd287dd23f832dd831f16e61bff16ee13e995d333e52708ebf600bb6be563aaeb3f16e61bff16ee13e995d333e02b284bf600bb6be10efc33ef16e61bff16ee13e995d333e1b05e7bd287dd23f832dd831f06e61bff06ee13eab5d33be01b284bf600bb6be15efc3bef06e61bff06ee13eab5d33be52708ebf600bb6be563aaeb3f06e61bff06ee13eab5d33be1b05e7bd287dd23f832dd831f61c3fbfef6ee13e4065ffbe94e551bf600bb6bef50435bff61c3fbfef6ee13e4065ffbe01b284bf600bb6be15efc3bef61c3fbfef6ee13e4065ffbe1b05e7bd287dd23f832dd8313965ffbeee6ee13ef91c3fbf52b0fdbe600bb6be61836cbf3965ffbeee6ee13ef91c3fbf94e551bf600bb6bef50435bf3965ffbeee6ee13ef91c3fbf1b05e7bd287dd23f832dd8319f5d33bef06ee13ef16e61bf1905e7bd600bb6be000080bf9f5d33bef06ee13ef16e61bf52b0fdbe600bb6be61836cbf9f5d33bef06ee13ef16e61bf1b05e7bd287dd23f832dd831b55d333ef06ee13eee6e61bfd42d8a3e600bb6be5d836cbfb55d333ef06ee13eee6e61bf1905e7bd600bb6be000080bfb55d333ef06ee13eee6e61bf1b05e7bd287dd23f832dd8314465ff3eef6ee13ef61c3fbf5424183f600bb6beef0435bf4465ff3eef6ee13ef61c3fbfd42d8a3e600bb6be5d836cbf4465ff3eef6ee13ef61c3fbf1b05e7bd287dd23f832dd831f91c3f3ff06ee13e3b65ffbebca24f3f600bb6be15efc3bef91c3f3ff06ee13e3b65ffbe5424183f600bb6beef0435bff91c3f3ff06ee13e3b65ffbe1b05e7bd287dd23f832dd831f06e613ff06ee13ea95d33be5d1f633f600bb6be832dd831f06e613ff06ee13ea95d33bebca24f3f600bb6be15efc3bef06e613ff06ee13ea95d33be5d1f633f600bb6be832dd83100000000000080bf00000000bba24f3f600bb6be16efc33e00000000000080bf000000005024183f600bb6bef304353f00000000000080bf000000005d1f633f600bb6be832dd83100000000000080bf000000005024183f600bb6bef304353f00000000000080bf00000000ce2d8a3e600bb6be5e836c3f00000000000080bf000000005d1f633f600bb6be832dd83100000000000080bf00000000ce2d8a3e600bb6be5e836c3f00000000000080bf000000002105e7bd600bb6be0000803f00000000000080bf000000005d1f633f600bb6be832dd83100000000000080bf000000002105e7bd600bb6be0000803f00000000000080bf000000005fb0fdbe600bb6be5e836c3f00000000000080bf000000005d1f633f600bb6be832dd83100000000000080bf000000005fb0fdbe600bb6be5e836c3f00000000000080bf0000000096e551bf600bb6bef304353f00000000000080bf000000005d1f633f600bb6be832dd83100000000ffff7fbf0000000096e551bf600bb6bef304353f00000000ffff7fbf0000000002b284bf600bb6be10efc33e00000000ffff7fbf000000005d1f633f600bb6be832dd83100000000ffff7fbf0000000002b284bf600bb6be10efc33e00000000ffff7fbf0000000052708ebf600bb6be563aaeb300000000ffff7fbf000000005d1f633f600bb6be832dd83100000000000080bf0000000052708ebf600bb6be563aaeb300000000000080bf0000000001b284bf600bb6be15efc3be00000000000080bf000000005d1f633f600bb6be832dd83100000000ffff7fbf0000000001b284bf600bb6be15efc3be00000000ffff7fbf0000000094e551bf600bb6bef50435bf00000000ffff7fbf000000005d1f633f600bb6be832dd83100000000000080bf0000000094e551bf600bb6bef50435bf00000000000080bf0000000052b0fdbe600bb6be61836cbf00000000000080bf000000005d1f633f600bb6be832dd83100000000ffff7fbf0000000052b0fdbe600bb6be61836cbf00000000ffff7fbf000000001905e7bd600bb6be000080bf00000000ffff7fbf000000005d1f633f600bb6be832dd83100000000000080bf000000001905e7bd600bb6be000080bf00000000000080bf00000000d42d8a3e600bb6be5d836cbf00000000000080bf000000005d1f633f600bb6be832dd83100000000000080bf00000000d42d8a3e600bb6be5d836cbf00000000000080bf000000005424183f600bb6beef0435bf00000000000080bf000000005d1f633f600bb6be832dd83100000000000080bf000000005424183f600bb6beef0435bf00000000000080bf00000000bca24f3f600bb6be15efc3be00000000000080bf00000000 + m_CompressedMesh: + m_Vertices: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_UV: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_Normals: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_Tangents: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_Weights: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_NormalSigns: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_TangentSigns: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_FloatColors: + m_NumItems: 0 + m_Range: 0 + m_Start: 0 + m_Data: + m_BitSize: 0 + m_BoneIndices: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_Triangles: + m_NumItems: 0 + m_Data: + m_BitSize: 0 + m_UVInfo: 0 + m_LocalAABB: + m_Center: {x: -0.112802714, y: 0.64444447, z: 0} + m_Extent: {x: 1, y: 1, z: 1} + m_MeshUsageFlags: 0 + m_CookingOptions: 30 + m_BakedConvexCollisionMesh: + m_BakedTriangleCollisionMesh: + m_MeshMetrics[0]: 1 + m_MeshMetrics[1]: 1 + m_MeshOptimizationFlags: 1 + m_StreamData: + serializedVersion: 2 + offset: 0 + size: 0 + path: diff --git a/Assets/Meshes/ConeMesh.asset.meta b/Assets/Meshes/ConeMesh.asset.meta new file mode 100644 index 0000000..d16802a --- /dev/null +++ b/Assets/Meshes/ConeMesh.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 36b72d5a34c22d94c88a068dfcbdf27a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 4300000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Models.meta b/Assets/Models.meta new file mode 100644 index 0000000..63c21b1 --- /dev/null +++ b/Assets/Models.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 70bebae970beec94a9b51706f48f3ca8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Prefabs/DroneTarget.prefab b/Assets/Resources/Prefabs/DroneTarget.prefab index f81583a..77cca29 100644 --- a/Assets/Resources/Prefabs/DroneTarget.prefab +++ b/Assets/Resources/Prefabs/DroneTarget.prefab @@ -1,6 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &4390675743535140416 +--- !u!1 &295999596028346972 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -8,47 +8,46 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 585396986125101381} - - component: {fileID: 6391750317931834964} - - component: {fileID: 7836489973151500992} - - component: {fileID: 1706763449576201087} + - component: {fileID: 9192475791974545516} + - component: {fileID: 3681380462727606042} + - component: {fileID: 5038767565634652910} m_Layer: 0 - m_Name: Model + m_Name: Cone m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &585396986125101381 +--- !u!4 &9192475791974545516 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4390675743535140416} + m_GameObject: {fileID: 295999596028346972} serializedVersion: 2 m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 10, y: 10, z: 10} + m_LocalScale: {x: 5, y: 5, z: 5} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 8462434346230391091} m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} ---- !u!33 &6391750317931834964 +--- !u!33 &3681380462727606042 MeshFilter: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4390675743535140416} - m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &7836489973151500992 + m_GameObject: {fileID: 295999596028346972} + m_Mesh: {fileID: 4300000, guid: 36b72d5a34c22d94c88a068dfcbdf27a, type: 2} +--- !u!23 &5038767565634652910 MeshRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4390675743535140416} + m_GameObject: {fileID: 295999596028346972} m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 @@ -63,7 +62,6 @@ MeshRenderer: m_RendererPriority: 0 m_Materials: - {fileID: 2100000, guid: 061083197c659dc44983633a84d39cea, type: 2} - - {fileID: 2100000, guid: 061083197c659dc44983633a84d39cea, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -85,13 +83,181 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!135 &1706763449576201087 -SphereCollider: +--- !u!1 &4390675743535140416 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 585396986125101381} + - component: {fileID: 4620404264009677289} + m_Layer: 0 + m_Name: TrailRenderer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &585396986125101381 +Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4390675743535140416} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 10, y: 10, z: 10} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8462434346230391091} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!96 &4620404264009677289 +TrailRenderer: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4390675743535140416} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 0 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 061083197c659dc44983633a84d39cea, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Time: 5 + m_PreviewTimeScale: 1 + m_Parameters: + serializedVersion: 3 + widthMultiplier: 1 + widthCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorGradient: + serializedVersion: 2 + key0: {r: 1, g: 0, b: 0, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_ColorSpace: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + numCornerVertices: 0 + numCapVertices: 0 + alignment: 0 + textureMode: 0 + textureScale: {x: 1, y: 1} + shadowBias: 0.5 + generateLightingData: 0 + m_MinVertexDistance: 0.1 + m_MaskInteraction: 0 + m_Autodestruct: 0 + m_Emitting: 1 + m_ApplyActiveColorSpace: 1 +--- !u!1 &4590233640347492898 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8315564871113561163} + - component: {fileID: 6203868598056538240} + m_Layer: 0 + m_Name: Collider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8315564871113561163 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4590233640347492898} + 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: 8462434346230391091} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!135 &6203868598056538240 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4590233640347492898} m_Material: {fileID: 0} m_IncludeLayers: serializedVersion: 2 @@ -104,7 +270,7 @@ SphereCollider: m_ProvidesContacts: 0 m_Enabled: 1 serializedVersion: 3 - m_Radius: 2 + m_Radius: 1 m_Center: {x: 0, y: 0, z: 0} --- !u!1 &6438458936967544359 GameObject: @@ -133,11 +299,13 @@ Transform: m_GameObject: {fileID: 6438458936967544359} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 25.88, z: -8.74} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 585396986125101381} + - {fileID: 8315564871113561163} + - {fileID: 9192475791974545516} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &4571646124809534626 diff --git a/Assets/Resources/Prefabs/HitMarkerPrefab.prefab b/Assets/Resources/Prefabs/HitMarkerPrefab.prefab new file mode 100644 index 0000000..fac712e --- /dev/null +++ b/Assets/Resources/Prefabs/HitMarkerPrefab.prefab @@ -0,0 +1,85 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &288626767100861231 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6053012910036459695} + - component: {fileID: 7807422260280084905} + - component: {fileID: 8345718946430300967} + m_Layer: 0 + m_Name: HitMarkerPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6053012910036459695 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 288626767100861231} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 50, y: 50, z: 50} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7807422260280084905 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 288626767100861231} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &8345718946430300967 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 288626767100861231} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: e95a32c351775244582551eee20b59e6, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} diff --git a/Assets/Resources/Prefabs/HitMarkerPrefab.prefab.meta b/Assets/Resources/Prefabs/HitMarkerPrefab.prefab.meta new file mode 100644 index 0000000..159ad77 --- /dev/null +++ b/Assets/Resources/Prefabs/HitMarkerPrefab.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2d46e1511135eb940bff780c9aecc3bc +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Prefabs/Micromissile.prefab b/Assets/Resources/Prefabs/Micromissile.prefab index f90f3e8..9f022ef 100644 --- a/Assets/Resources/Prefabs/Micromissile.prefab +++ b/Assets/Resources/Prefabs/Micromissile.prefab @@ -1,6 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &7332702951742698389 +--- !u!1 &1774642932335845908 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -8,48 +8,46 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 6143500333118391380} - - component: {fileID: 3118470243300855439} - - component: {fileID: 3737217228513396687} - - component: {fileID: 6455796705426260973} - - component: {fileID: 477015890325605793} + - component: {fileID: 2302102919875387210} + - component: {fileID: 707913893366896963} + - component: {fileID: 8897178732853577025} m_Layer: 0 - m_Name: Model + m_Name: ConeModel m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &6143500333118391380 +--- !u!4 &2302102919875387210 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7332702951742698389} + m_GameObject: {fileID: 1774642932335845908} serializedVersion: 2 m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 10, y: 10, z: 10} + m_LocalScale: {x: 5, y: 5, z: 5} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 7973970135794769061} m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} ---- !u!33 &3118470243300855439 +--- !u!33 &707913893366896963 MeshFilter: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7332702951742698389} - m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &3737217228513396687 + m_GameObject: {fileID: 1774642932335845908} + m_Mesh: {fileID: 4300000, guid: 36b72d5a34c22d94c88a068dfcbdf27a, type: 2} +--- !u!23 &8897178732853577025 MeshRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7332702951742698389} + m_GameObject: {fileID: 1774642932335845908} m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 @@ -63,7 +61,6 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 2100000, guid: f09133e0e18241045a6efe65c0415cae, type: 2} m_StaticBatchInfo: firstSubMesh: 0 @@ -86,13 +83,45 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!135 &6455796705426260973 +--- !u!1 &2025009473726897957 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8990913283091743740} + - component: {fileID: 6283448175337170139} + m_Layer: 0 + m_Name: Collider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8990913283091743740 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2025009473726897957} + 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: 7973970135794769061} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!135 &6283448175337170139 SphereCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7332702951742698389} + m_GameObject: {fileID: 2025009473726897957} m_Material: {fileID: 0} m_IncludeLayers: serializedVersion: 2 @@ -105,8 +134,40 @@ SphereCollider: m_ProvidesContacts: 0 m_Enabled: 1 serializedVersion: 3 - m_Radius: 2 + m_Radius: 10 m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &7332702951742698389 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6143500333118391380} + - component: {fileID: 477015890325605793} + m_Layer: 0 + m_Name: TrailRenderer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6143500333118391380 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7332702951742698389} + serializedVersion: 2 + m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 10, y: 10, z: 10} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7973970135794769061} + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} --- !u!96 &477015890325605793 TrailRenderer: serializedVersion: 3 @@ -243,6 +304,8 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 6143500333118391380} + - {fileID: 2302102919875387210} + - {fileID: 8990913283091743740} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1425538033197365278 diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 636be96..da94829 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -122,6 +122,218 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &96812608 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 96812609} + - component: {fileID: 96812612} + - component: {fileID: 96812611} + - component: {fileID: 96812610} + m_Layer: 0 + m_Name: Wall2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &96812609 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 96812608} + serializedVersion: 2 + m_LocalRotation: {x: 0.5, y: 0.5, z: 0.5, w: 0.5} + m_LocalPosition: {x: 0, y: 5000, z: -5000} + m_LocalScale: {x: 1000, y: 1, z: 1000} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 674567085} + m_LocalEulerAnglesHint: {x: 0, y: 90, z: 90} +--- !u!64 &96812610 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 96812608} + 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: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &96812611 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 96812608} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &96812612 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 96812608} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &117119891 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 117119892} + - component: {fileID: 117119895} + - component: {fileID: 117119894} + - component: {fileID: 117119893} + m_Layer: 0 + m_Name: Wall1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &117119892 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 117119891} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: -0.7071068, w: 0.7071068} + m_LocalPosition: {x: -5000, y: 5000, z: 0} + m_LocalScale: {x: 1000, y: 1, z: 1000} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 674567085} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: -90} +--- !u!64 &117119893 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 117119891} + 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: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &117119894 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 117119891} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &117119895 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 117119891} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &253946925 GameObject: m_ObjectHideFlags: 0 @@ -151,7 +363,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 84f2990fd69b0284ca96912cbe968b62, type: 3} m_Name: m_EditorClassIdentifier: - simulationConfig: {fileID: 11400000, guid: 81fed29b611ef7041a9db3e4513885ca, type: 2} + simulationConfig: {fileID: 11400000, guid: b7e9e8f13e8db0f47a33344c45790f20, type: 2} --- !u!4 &253946927 Transform: m_ObjectHideFlags: 0 @@ -167,6 +379,112 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &320210793 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 320210794} + - component: {fileID: 320210797} + - component: {fileID: 320210796} + - component: {fileID: 320210795} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &320210794 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 320210793} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1000, y: 1, z: 1000} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 674567085} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &320210795 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 320210793} + 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: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &320210796 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 320210793} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &320210797 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 320210793} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &674567081 GameObject: m_ObjectHideFlags: 0 @@ -180,7 +498,7 @@ GameObject: - component: {fileID: 674567083} - component: {fileID: 674567082} m_Layer: 0 - m_Name: Plane + m_Name: EnvironmentBounds m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -268,9 +586,12 @@ Transform: serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1000, y: 1000, z: 1000} + m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 320210794} + - {fileID: 117119892} + - {fileID: 96812609} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 diff --git a/Assets/Scripts/Agent.cs b/Assets/Scripts/Agent.cs index a8f6aef..f2818a9 100644 --- a/Assets/Scripts/Agent.cs +++ b/Assets/Scripts/Agent.cs @@ -25,6 +25,7 @@ public abstract class Agent : MonoBehaviour [SerializeField] protected Agent _target; protected bool _isHit = false; + protected bool _isMiss = false; protected DynamicConfig _dynamicConfig; [SerializeField] @@ -71,10 +72,25 @@ public abstract class Agent : MonoBehaviour return _isHit; } + public bool IsMiss() { + return _isMiss; + } + + public void TerminateAgent() { + _flightPhase = FlightPhase.TERMINATED; + transform.position = new Vector3(0, 0, 0); + gameObject.SetActive(false); + } + // Mark the agent as having hit the target or been hit. public void MarkAsHit() { _isHit = true; - _flightPhase = FlightPhase.TERMINATED; + TerminateAgent(); + } + + public void MarkAsMiss() { + _isMiss = true; + TerminateAgent(); } @@ -147,7 +163,7 @@ public abstract class Agent : MonoBehaviour Quaternion targetRotation = Quaternion.LookRotation(velocity, Vector3.up); // Smoothly rotate towards the target rotation - transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, 100f * Time.deltaTime); + transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, 1000f * Time.deltaTime); } } diff --git a/Assets/Scripts/Assignment.meta b/Assets/Scripts/Assignment.meta new file mode 100644 index 0000000..cf2e9ad --- /dev/null +++ b/Assets/Scripts/Assignment.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 06e870818cf329e49a0d0c5a0d024f21 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Assignment.cs b/Assets/Scripts/Assignment/Assignment.cs similarity index 100% rename from Assets/Scripts/Assignment.cs rename to Assets/Scripts/Assignment/Assignment.cs diff --git a/Assets/Scripts/Assignment.cs.meta b/Assets/Scripts/Assignment/Assignment.cs.meta similarity index 100% rename from Assets/Scripts/Assignment.cs.meta rename to Assets/Scripts/Assignment/Assignment.cs.meta diff --git a/Assets/Scripts/RoundRobinAssignment.cs b/Assets/Scripts/Assignment/RoundRobinAssignment.cs similarity index 100% rename from Assets/Scripts/RoundRobinAssignment.cs rename to Assets/Scripts/Assignment/RoundRobinAssignment.cs diff --git a/Assets/Scripts/RoundRobinAssignment.cs.meta b/Assets/Scripts/Assignment/RoundRobinAssignment.cs.meta similarity index 100% rename from Assets/Scripts/RoundRobinAssignment.cs.meta rename to Assets/Scripts/Assignment/RoundRobinAssignment.cs.meta diff --git a/Assets/Scripts/Assignment/ThreatAssignment.cs b/Assets/Scripts/Assignment/ThreatAssignment.cs new file mode 100644 index 0000000..8469cc8 --- /dev/null +++ b/Assets/Scripts/Assignment/ThreatAssignment.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +// The threat assignment class assigns missiles to the targets based +// on the threat level of the targets. +public class ThreatAssignment : Assignment +{ + // Assign a target to each missile that has not been assigned a target yet. + public override void Assign(List missiles, List targets) + { + List assignableMissileIndices = GetAssignableMissileIndices(missiles); + if (assignableMissileIndices.Count == 0) + { + return; + } + + List activeTargetIndices = GetActiveTargetIndices(targets); + if (activeTargetIndices.Count == 0) + { + return; + } + + Vector3 missilesMeanPosition = CalculateMeanPosition(missiles); + List threatInfos = CalculateThreatLevels(targets, activeTargetIndices, missilesMeanPosition); + + foreach (int missileIndex in assignableMissileIndices) + { + if (threatInfos.Count == 0) break; + + ThreatInfo highestThreat = threatInfos[0]; + missileToTargetAssignments.AddFirst(new AssignmentItem(missileIndex, highestThreat.TargetIndex)); + threatInfos.RemoveAt(0); + } + } + + private Vector3 CalculateMeanPosition(List agents) + { + return agents.Aggregate(Vector3.zero, (sum, agent) => sum + agent.transform.position) / agents.Count; + } + + private List CalculateThreatLevels(List targets, List activeTargetIndices, Vector3 missilesMeanPosition) + { + List threatInfos = new List(); + + foreach (int targetIndex in activeTargetIndices) + { + Agent target = targets[targetIndex]; + float distanceToMean = Vector3.Distance(target.transform.position, missilesMeanPosition); + float velocityMagnitude = target.GetVelocity().magnitude; + + // Calculate threat level based on proximity and velocity + float threatLevel = (1 / distanceToMean) * velocityMagnitude; + + threatInfos.Add(new ThreatInfo(targetIndex, threatLevel)); + } + + // Sort threats in descending order + return threatInfos.OrderByDescending(t => t.ThreatLevel).ToList(); + } + + private class ThreatInfo + { + public int TargetIndex { get; } + public float ThreatLevel { get; } + + public ThreatInfo(int targetIndex, float threatLevel) + { + TargetIndex = targetIndex; + ThreatLevel = threatLevel; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Assignment/ThreatAssignment.cs.meta b/Assets/Scripts/Assignment/ThreatAssignment.cs.meta new file mode 100644 index 0000000..7e5a47b --- /dev/null +++ b/Assets/Scripts/Assignment/ThreatAssignment.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8e9829915a9eb41409ea03fb46910432 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Config.meta b/Assets/Scripts/Config.meta new file mode 100644 index 0000000..dab3e1c --- /dev/null +++ b/Assets/Scripts/Config.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 068fab6561d36f445b1d765a9d3af005 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SimulationConfig.cs b/Assets/Scripts/Config/SimulationConfig.cs similarity index 100% rename from Assets/Scripts/SimulationConfig.cs rename to Assets/Scripts/Config/SimulationConfig.cs diff --git a/Assets/Scripts/SimulationConfig.cs.meta b/Assets/Scripts/Config/SimulationConfig.cs.meta similarity index 100% rename from Assets/Scripts/SimulationConfig.cs.meta rename to Assets/Scripts/Config/SimulationConfig.cs.meta diff --git a/Assets/Scripts/StaticConfig.cs b/Assets/Scripts/Config/StaticConfig.cs similarity index 100% rename from Assets/Scripts/StaticConfig.cs rename to Assets/Scripts/Config/StaticConfig.cs diff --git a/Assets/Scripts/StaticConfig.cs.meta b/Assets/Scripts/Config/StaticConfig.cs.meta similarity index 100% rename from Assets/Scripts/StaticConfig.cs.meta rename to Assets/Scripts/Config/StaticConfig.cs.meta diff --git a/Assets/Scripts/Editor.meta b/Assets/Scripts/Editor.meta new file mode 100644 index 0000000..a70bda4 --- /dev/null +++ b/Assets/Scripts/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 91594f3f9a39e6746879216d6dd0d4ec +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Editor/GenerateCone.cs b/Assets/Scripts/Editor/GenerateCone.cs new file mode 100644 index 0000000..9c35711 --- /dev/null +++ b/Assets/Scripts/Editor/GenerateCone.cs @@ -0,0 +1,157 @@ +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; + +public class GenerateCone : EditorWindow +{ + private int sides = 16; + private float baseRadius = 1f; + private float height = 2f; + + [MenuItem("GameObject/3D Object/Cone", false, 10)] + static void CreateCone() + { + GameObject cone; + GameObject selectedObject = Selection.activeGameObject; + + if (selectedObject != null) + { + // Create as child of selected object + cone = new GameObject("Cone"); + cone.transform.SetParent(selectedObject.transform, false); + } + else + { + // Create as new root object + cone = new GameObject("Cone"); + } + + cone.AddComponent(); + cone.AddComponent(); + Undo.RegisterCreatedObjectUndo(cone, "Create Cone"); + + var window = ScriptableObject.CreateInstance(); + window.GenerateConeObject(cone); + + Selection.activeGameObject = cone; + } + + void GenerateConeObject(GameObject cone) + { + Mesh mesh = CreateConeMesh("ConeMesh", sides, Vector3.zero, Quaternion.identity, baseRadius, height); + + // Save the mesh as an asset + string path = "Assets/Meshes"; + if (!AssetDatabase.IsValidFolder(path)) + { + AssetDatabase.CreateFolder("Assets", "Meshes"); + } + string assetPath = AssetDatabase.GenerateUniqueAssetPath(path + "/ConeMesh.asset"); + AssetDatabase.CreateAsset(mesh, assetPath); + AssetDatabase.SaveAssets(); + + // Assign the mesh to the MeshFilter + cone.GetComponent().sharedMesh = mesh; + cone.GetComponent().material = new Material(Shader.Find("Standard")); + } + + Vector2[] GetBasePoints(int vertices, float radius) + { + const float TAU = 2f * Mathf.PI; + var pts = new Vector2[vertices]; + var step = TAU / vertices; // angular step between two vertices + for (int i = 0; i < vertices; i++) + { + pts[i] = radius * Trig(i * step); // convert polar coordinate to cartesian space + } + return pts; + } + + static Vector2 Trig(float rad) => new Vector2(Mathf.Cos(rad), Mathf.Sin(rad)); + + Vector3[] BuildConeVertices(Vector2[] baseVerts, float coneHeight) + { + if (baseVerts == null || baseVerts.Length < 3) throw new InvalidOperationException("Requires at least 3 base vertices."); + var verts = new Vector3[baseVerts.Length + 1]; + verts[0] = new Vector3(0f, coneHeight, 0f); + for (int i = 0; i < baseVerts.Length; i++) + { + verts[i + 1] = new Vector3(baseVerts[i].x, 0f, baseVerts[i].y); + } + return verts; + } + + void ConstructCone(Vector3[] coneVerts, List finalVerts, List triangles) + { + if (coneVerts == null || coneVerts.Length < 4) throw new InvalidOperationException("Requires at least 4 vertices."); + if (finalVerts == null || triangles == null) throw new ArgumentNullException(); + + finalVerts.Clear(); + triangles.Clear(); + + var rimVertices = coneVerts.Length - 1; + + // Side faces + for (int i = 1; i <= rimVertices; i++) + { + int a = i, b = i < rimVertices ? i + 1 : 1; + AddTriangle(coneVerts[0], coneVerts[b], coneVerts[a]); + } + + // Base face + for (int i = 1; i < rimVertices - 1; i++) + { + AddTriangle(coneVerts[1], coneVerts[i + 1], coneVerts[i + 2]); + } + + void AddTriangle(Vector3 t1, Vector3 t2, Vector3 t3) + { + finalVerts.Add(t1); + finalVerts.Add(t2); + finalVerts.Add(t3); + triangles.Add(finalVerts.Count - 3); + triangles.Add(finalVerts.Count - 2); + triangles.Add(finalVerts.Count - 1); + } + } + Mesh CreateConeMesh(string name, int sides, Vector3 apex, Quaternion rotation, float baseRadius, float height) + { + var baseVerts = GetBasePoints(sides, baseRadius); + var coneVerts = BuildConeVertices(baseVerts, height); + + var verts = new List(); + var tris = new List(); + ConstructCone(coneVerts, verts, tris); + + for (int i = 0; i < verts.Count; i++) + { + verts[i] = rotation * (verts[i] - coneVerts[0]); + } + + // Recenter the cone + Vector3 center = CalculateCenter(verts); + for (int i = 0; i < verts.Count; i++) + { + verts[i] = verts[i] - center + apex; + } + + Mesh mesh = new Mesh(); + mesh.name = name; + mesh.SetVertices(verts); + mesh.SetTriangles(tris.ToArray(), 0); + mesh.RecalculateNormals(); + + return mesh; + } + + Vector3 CalculateCenter(List vertices) + { + Vector3 sum = Vector3.zero; + foreach (Vector3 vert in vertices) + { + sum += vert; + } + return sum / vertices.Count; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Editor/GenerateCone.cs.meta b/Assets/Scripts/Editor/GenerateCone.cs.meta new file mode 100644 index 0000000..9200270 --- /dev/null +++ b/Assets/Scripts/Editor/GenerateCone.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27925dcc8d7b5dd4ab28ed7de5b806a4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Interceptors.meta b/Assets/Scripts/Interceptors.meta new file mode 100644 index 0000000..6257e00 --- /dev/null +++ b/Assets/Scripts/Interceptors.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6f05ad8af46b8df4c9720b5deb691295 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Micromissile.cs b/Assets/Scripts/Interceptors/Micromissile.cs similarity index 88% rename from Assets/Scripts/Micromissile.cs rename to Assets/Scripts/Interceptors/Micromissile.cs index 423cb63..b3dfac7 100644 --- a/Assets/Scripts/Micromissile.cs +++ b/Assets/Scripts/Interceptors/Micromissile.cs @@ -30,17 +30,9 @@ public class Micromissile : Missile // Sense the target SensorOutput sensorOutput = GetComponent().Sense(_target); - - // Check whether the target has been hit - if (_target.IsHit()) - { - float killProbability = _target.GetComponent().StaticConfig.hitConfig.killProbability; - if (Random.value < killProbability) - { - MarkAsHit(); - _target.MarkAsHit(); - return; - } + if(sensorOutput.velocity.range > 1000f) { + this.MarkAsMiss(); + _target.MarkAsMiss(); } // Calculate the acceleration input @@ -94,10 +86,10 @@ public class Micromissile : Missile Debug.DrawLine(transform.position, _target.transform.position, Color.white); // Velocity vector - Debug.DrawRay(transform.position, GetVelocity(), Color.blue); + Debug.DrawRay(transform.position, GetVelocity()*0.01f, Color.blue); // Acceleration input - Debug.DrawRay(transform.position, _accelerationCommand*1000f, Color.green); + Debug.DrawRay(transform.position, _accelerationCommand*1f, Color.green); // Current forward direction Debug.DrawRay(transform.position, transform.forward * 5f, Color.yellow); diff --git a/Assets/Scripts/Micromissile.cs.meta b/Assets/Scripts/Interceptors/Micromissile.cs.meta similarity index 100% rename from Assets/Scripts/Micromissile.cs.meta rename to Assets/Scripts/Interceptors/Micromissile.cs.meta diff --git a/Assets/Scripts/Missile.cs b/Assets/Scripts/Missile.cs index 964f04b..4d53965 100644 --- a/Assets/Scripts/Missile.cs +++ b/Assets/Scripts/Missile.cs @@ -79,11 +79,22 @@ public class Missile : Agent { // Check kill probability before marking as hit float killProbability = StaticConfig.hitConfig.killProbability; + GameObject markerObject = Instantiate(Resources.Load("Prefabs/HitMarkerPrefab"), transform.position, Quaternion.identity); if (Random.value <= killProbability) { + // Set green for hit + markerObject.GetComponent().material.color = new Color(0, 1, 0, 0.5f); // Mark both this agent and the other agent as hit this.MarkAsHit(); otherAgent.MarkAsHit(); + + } + else { + // Set red for miss + markerObject.GetComponent().material.color = new Color(1, 0, 0, 0.5f); + this.MarkAsMiss(); + otherAgent.MarkAsMiss(); + } } } diff --git a/Assets/Scripts/Sensors.meta b/Assets/Scripts/Sensors.meta new file mode 100644 index 0000000..b6d12ed --- /dev/null +++ b/Assets/Scripts/Sensors.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8c45dceac2c26594d8ac013a8f72e042 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/IdealSensor.cs b/Assets/Scripts/Sensors/IdealSensor.cs similarity index 100% rename from Assets/Scripts/IdealSensor.cs rename to Assets/Scripts/Sensors/IdealSensor.cs diff --git a/Assets/Scripts/IdealSensor.cs.meta b/Assets/Scripts/Sensors/IdealSensor.cs.meta similarity index 100% rename from Assets/Scripts/IdealSensor.cs.meta rename to Assets/Scripts/Sensors/IdealSensor.cs.meta diff --git a/Assets/Scripts/Sensor.cs b/Assets/Scripts/Sensors/Sensor.cs similarity index 100% rename from Assets/Scripts/Sensor.cs rename to Assets/Scripts/Sensors/Sensor.cs diff --git a/Assets/Scripts/Sensor.cs.meta b/Assets/Scripts/Sensors/Sensor.cs.meta similarity index 100% rename from Assets/Scripts/Sensor.cs.meta rename to Assets/Scripts/Sensors/Sensor.cs.meta diff --git a/Assets/Scripts/SimManager.cs b/Assets/Scripts/SimManager.cs index 48d4b21..998d3f9 100644 --- a/Assets/Scripts/SimManager.cs +++ b/Assets/Scripts/SimManager.cs @@ -26,7 +26,7 @@ public class SimManager : MonoBehaviour simulationRunning = true; } - private void InitializeSimulation() + private void InitializeSimulation() { // Create missiles based on config foreach (var swarmConfig in simulationConfig.missile_swarm_configs) @@ -46,7 +46,7 @@ public class SimManager : MonoBehaviour } } - _assignment = new RoundRobinAssignment(); + _assignment = new ThreatAssignment(); // Perform initial assignment AssignMissilesToTargets(); } @@ -191,7 +191,7 @@ public class SimManager : MonoBehaviour bool allMissilesTerminated = true; foreach (var missile in missiles) { - if (missile != null && !missile.IsHit()) + if (missile != null && !missile.IsHit() && !missile.IsMiss()) { allMissilesTerminated = false; break; diff --git a/Assets/Scripts/Targets.meta b/Assets/Scripts/Targets.meta new file mode 100644 index 0000000..d3f1b0b --- /dev/null +++ b/Assets/Scripts/Targets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2342a881813cdd645962533af3f6f755 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DroneTarget.cs b/Assets/Scripts/Targets/DroneTarget.cs similarity index 100% rename from Assets/Scripts/DroneTarget.cs rename to Assets/Scripts/Targets/DroneTarget.cs diff --git a/Assets/Scripts/DroneTarget.cs.meta b/Assets/Scripts/Targets/DroneTarget.cs.meta similarity index 100% rename from Assets/Scripts/DroneTarget.cs.meta rename to Assets/Scripts/Targets/DroneTarget.cs.meta diff --git a/Assets/Scripts/MissileTarget.cs b/Assets/Scripts/Targets/MissileTarget.cs similarity index 100% rename from Assets/Scripts/MissileTarget.cs rename to Assets/Scripts/Targets/MissileTarget.cs diff --git a/Assets/Scripts/MissileTarget.cs.meta b/Assets/Scripts/Targets/MissileTarget.cs.meta similarity index 100% rename from Assets/Scripts/MissileTarget.cs.meta rename to Assets/Scripts/Targets/MissileTarget.cs.meta diff --git a/Assets/Scripts/Target.cs b/Assets/Scripts/Targets/Target.cs similarity index 100% rename from Assets/Scripts/Target.cs rename to Assets/Scripts/Targets/Target.cs diff --git a/Assets/Scripts/Target.cs.meta b/Assets/Scripts/Targets/Target.cs.meta similarity index 100% rename from Assets/Scripts/Target.cs.meta rename to Assets/Scripts/Targets/Target.cs.meta diff --git a/Assets/SimulationConfigMany.asset b/Assets/SimulationConfigMany.asset new file mode 100644 index 0000000..ab9d5d6 --- /dev/null +++ b/Assets/SimulationConfigMany.asset @@ -0,0 +1,109 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + 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: 79f1fe138866d6a40b209a4edcf2ee06, type: 3} + m_Name: SimulationConfigMany + m_EditorClassIdentifier: + timeScale: 0.2 + missile_swarm_configs: + - num_agents: 200 + agent_config: + missile_type: 1 + target_type: 0 + initial_state: + position: {x: 0, y: 50, z: -500} + rotation: {x: -45, y: 0, z: 0} + velocity: {x: 0, y: 0, z: 10} + standard_deviation: + position: {x: 10, y: 10, z: 10} + velocity: {x: 0, y: 0, z: 0} + dynamic_config: + launch_config: + launch_time: 0 + sensor_config: + type: 0 + frequency: 0 + plotting_config: + color: {r: 0, g: 0, b: 0, a: 0} + linestyle: 0 + marker: 0 + submunitions_config: + num_submunitions: 0 + launch_config: + launch_time: 0 + agent_config: + missile_type: 0 + initial_state: + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0} + velocity: {x: 0, y: 0, z: 0} + standard_deviation: + position: {x: 0, y: 0, z: 0} + velocity: {x: 0, y: 0, z: 0} + dynamic_config: + launch_config: + launch_time: 0 + sensor_config: + type: 0 + frequency: 0 + plotting_config: + color: {r: 0, g: 0, b: 0, a: 0} + linestyle: 0 + marker: 0 + prefabName: + prefabName: Micromissile + target_swarm_configs: + - num_agents: 200 + agent_config: + missile_type: 0 + target_type: 0 + initial_state: + position: {x: 0, y: 100, z: 2000} + rotation: {x: 90, y: 0, z: 0} + velocity: {x: 0, y: 0, z: -150} + standard_deviation: + position: {x: 500, y: 50, z: 100} + velocity: {x: 0, y: 0, z: 50} + dynamic_config: + launch_config: + launch_time: 0 + sensor_config: + type: 0 + frequency: 0 + plotting_config: + color: {r: 0, g: 0, b: 0, a: 0} + linestyle: 0 + marker: 0 + submunitions_config: + num_submunitions: 0 + launch_config: + launch_time: 0 + agent_config: + missile_type: 0 + initial_state: + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0} + velocity: {x: 0, y: 0, z: 0} + standard_deviation: + position: {x: 0, y: 0, z: 0} + velocity: {x: 0, y: 0, z: 0} + dynamic_config: + launch_config: + launch_time: 0 + sensor_config: + type: 0 + frequency: 0 + plotting_config: + color: {r: 0, g: 0, b: 0, a: 0} + linestyle: 0 + marker: 0 + prefabName: + prefabName: DroneTarget diff --git a/Assets/SimulationConfigMany.asset.meta b/Assets/SimulationConfigMany.asset.meta new file mode 100644 index 0000000..30ff1a7 --- /dev/null +++ b/Assets/SimulationConfigMany.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b7e9e8f13e8db0f47a33344c45790f20 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: