From d0ef6c3fc4e24b82700a1e8ee91ca49f2d894711 Mon Sep 17 00:00:00 2001 From: Daniel Lovell Date: Thu, 12 Sep 2024 20:06:47 -0700 Subject: [PATCH] WIP IADS and Vessel structure --- Assets/Scenes/MainScene.unity | 69 ++++++++++++++++++++++++++++ Assets/Scripts/IADS.meta | 8 ++++ Assets/Scripts/IADS/IADS.cs | 39 ++++++++++++++++ Assets/Scripts/IADS/IADS.cs.meta | 11 +++++ Assets/Scripts/IADS/Vessel.cs | 33 +++++++++++++ Assets/Scripts/IADS/Vessel.cs.meta | 11 +++++ Assets/SimulationConfigHydra70.asset | 18 ++++---- 7 files changed, 180 insertions(+), 9 deletions(-) create mode 100644 Assets/Scripts/IADS.meta create mode 100644 Assets/Scripts/IADS/IADS.cs create mode 100644 Assets/Scripts/IADS/IADS.cs.meta create mode 100644 Assets/Scripts/IADS/Vessel.cs create mode 100644 Assets/Scripts/IADS/Vessel.cs.meta diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index a0210e0..b9790b2 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -2385,6 +2385,74 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &2052906803 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2052906806} + - component: {fileID: 2052906805} + - component: {fileID: 2052906804} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2052906804 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2052906803} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &2052906805 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2052906803} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &2052906806 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2052906803} + 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: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 @@ -2394,3 +2462,4 @@ SceneRoots: - {fileID: 674567085} - {fileID: 253946927} - {fileID: 694951366} + - {fileID: 2052906806} diff --git a/Assets/Scripts/IADS.meta b/Assets/Scripts/IADS.meta new file mode 100644 index 0000000..ff65a33 --- /dev/null +++ b/Assets/Scripts/IADS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9c6197c2ed2c6bc49b0667188a72a29d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/IADS/IADS.cs b/Assets/Scripts/IADS/IADS.cs new file mode 100644 index 0000000..8678420 --- /dev/null +++ b/Assets/Scripts/IADS/IADS.cs @@ -0,0 +1,39 @@ +using UnityEngine; +using System.Collections.Generic; +using System.Collections; +using System; + +// Integrated Air Defense System +public class IADS : MonoBehaviour +{ + + public enum TargetStatus { + UNASSIGNED, + ASSIGNED, + HIT, + DEGRADED, + DESTROYED + } + + // Look up target status by unique target ID + public Dictionary _targetStatusDictionary; + + private List _targets; + + private List _missiles; + + private List _vessels; + + public delegate void RegisterNewTargetDelegate(Target target); + public event RegisterNewTargetDelegate OnRegisterNewTarget; + + void Start() + { + _targets = new List(); + } + + public void RegisterNewTarget(Target target) { + _targets.Add(target); + OnRegisterNewTarget?.Invoke(target); + } +} \ No newline at end of file diff --git a/Assets/Scripts/IADS/IADS.cs.meta b/Assets/Scripts/IADS/IADS.cs.meta new file mode 100644 index 0000000..7a07cbb --- /dev/null +++ b/Assets/Scripts/IADS/IADS.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a5899f1049cf3d64e8c06c1db772c879 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/IADS/Vessel.cs b/Assets/Scripts/IADS/Vessel.cs new file mode 100644 index 0000000..c243548 --- /dev/null +++ b/Assets/Scripts/IADS/Vessel.cs @@ -0,0 +1,33 @@ +using UnityEngine; +using System.Collections.Generic; + +public class Vessel : MonoBehaviour +{ + [SerializeField] + private List missileInventory = new List(); + + public void AddMissile(Missile missile) + { + if (missile != null) + { + missileInventory.Add(missile); + } + } + + public void RemoveMissile(Missile missile) + { + missileInventory.Remove(missile); + } + + public List GetMissileInventory() + { + return new List(missileInventory); + } + + public int GetMissileCount() + { + return missileInventory.Count; + } + + // Additional methods can be added here as needed +} diff --git a/Assets/Scripts/IADS/Vessel.cs.meta b/Assets/Scripts/IADS/Vessel.cs.meta new file mode 100644 index 0000000..3f15eed --- /dev/null +++ b/Assets/Scripts/IADS/Vessel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 607b5f69ae2775c4ab0089839f65fd61 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SimulationConfigHydra70.asset b/Assets/SimulationConfigHydra70.asset index 6f4cc6e..5f6adff 100644 --- a/Assets/SimulationConfigHydra70.asset +++ b/Assets/SimulationConfigHydra70.asset @@ -14,37 +14,37 @@ MonoBehaviour: m_EditorClassIdentifier: timeScale: 0.2 missile_swarm_configs: - - num_agents: 10 + - num_agents: 20 agent_config: missile_type: 0 target_type: 0 initial_state: position: {x: 0, y: 10, z: 0} rotation: {x: -45, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 10} + velocity: {x: 0, y: 10, z: 10} standard_deviation: position: {x: 10, y: 10, z: 10} - velocity: {x: 0, y: 0, z: 0} + velocity: {x: 5, y: 0, z: 5} dynamic_config: launch_config: launch_time: 0 sensor_config: type: 0 - frequency: 0 + frequency: 1 plotting_config: color: {r: 0, g: 0, b: 0, a: 0} linestyle: 0 marker: 0 submunitions_config: - num_submunitions: 10 + num_submunitions: 7 launch_config: - launch_time: 2 + launch_time: 1.5 agent_config: missile_type: 1 initial_state: - position: {x: 0, y: 0, z: 0} + position: {x: -38.074936, y: 286.19226, z: 293.8709} rotation: {x: 0, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 0} + velocity: {x: -20.437624, y: 181.02332, z: 193.21309} standard_deviation: position: {x: 5, y: 5, z: 5} velocity: {x: 0, y: 0, z: 0} @@ -53,7 +53,7 @@ MonoBehaviour: launch_time: 0 sensor_config: type: 0 - frequency: 0 + frequency: 1 plotting_config: color: {r: 0, g: 0, b: 0, a: 0} linestyle: 0