diff --git a/Assets/Images.meta b/Assets/Images.meta new file mode 100644 index 0000000..688a45a --- /dev/null +++ b/Assets/Images.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: abde7190bfdabb144b4a88431354716b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Images/micromissile.png b/Assets/Images/micromissile.png new file mode 100644 index 0000000..88e609a Binary files /dev/null and b/Assets/Images/micromissile.png differ diff --git a/Assets/Images/micromissile.png.meta b/Assets/Images/micromissile.png.meta new file mode 100644 index 0000000..c735a82 --- /dev/null +++ b/Assets/Images/micromissile.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: c9e103a72cacde84ab9cd7dfeef678d2 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Images/micromissile2.png b/Assets/Images/micromissile2.png new file mode 100644 index 0000000..80882cd Binary files /dev/null and b/Assets/Images/micromissile2.png differ diff --git a/Assets/Images/micromissile2.png.meta b/Assets/Images/micromissile2.png.meta new file mode 100644 index 0000000..2cd1b6d --- /dev/null +++ b/Assets/Images/micromissile2.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: f0c085caebb9eb14985bf3a253e0a5df +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Images/micromissile_cropped.png b/Assets/Images/micromissile_cropped.png new file mode 100644 index 0000000..3ce2047 Binary files /dev/null and b/Assets/Images/micromissile_cropped.png differ diff --git a/Assets/Images/micromissile_cropped.png.meta b/Assets/Images/micromissile_cropped.png.meta new file mode 100644 index 0000000..bc460d1 --- /dev/null +++ b/Assets/Images/micromissile_cropped.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: 799154081e756314d8bf09b6c74bcde7 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RP/URP Pipepline Asset.asset b/Assets/RP/URP Pipepline Asset.asset index 7b5193a..32c8c9a 100644 --- a/Assets/RP/URP Pipepline Asset.asset +++ b/Assets/RP/URP Pipepline Asset.asset @@ -82,33 +82,33 @@ MonoBehaviour: m_Textures: blueNoise64LTex: {fileID: 2800000, guid: e3d24661c1e055f45a7560c033dbb837, type: 3} bayerMatrixTex: {fileID: 2800000, guid: f9ee4ed84c1d10c49aabb9b210b0fc44, type: 3} - m_PrefilteringModeMainLightShadows: 1 - m_PrefilteringModeAdditionalLight: 4 - m_PrefilteringModeAdditionalLightShadows: 1 - m_PrefilterXRKeywords: 0 - m_PrefilteringModeForwardPlus: 1 - m_PrefilteringModeDeferredRendering: 1 - m_PrefilteringModeScreenSpaceOcclusion: 1 - m_PrefilterDebugKeywords: 0 - m_PrefilterWriteRenderingLayers: 0 - m_PrefilterHDROutput: 0 - m_PrefilterSSAODepthNormals: 0 - m_PrefilterSSAOSourceDepthLow: 0 - m_PrefilterSSAOSourceDepthMedium: 0 - m_PrefilterSSAOSourceDepthHigh: 0 - m_PrefilterSSAOInterleaved: 0 - m_PrefilterSSAOBlueNoise: 0 - m_PrefilterSSAOSampleCountLow: 0 - m_PrefilterSSAOSampleCountMedium: 0 - m_PrefilterSSAOSampleCountHigh: 0 - m_PrefilterDBufferMRT1: 0 - m_PrefilterDBufferMRT2: 0 - m_PrefilterDBufferMRT3: 0 - m_PrefilterSoftShadowsQualityLow: 0 - m_PrefilterSoftShadowsQualityMedium: 0 - m_PrefilterSoftShadowsQualityHigh: 0 + m_PrefilteringModeMainLightShadows: 3 + m_PrefilteringModeAdditionalLight: 3 + m_PrefilteringModeAdditionalLightShadows: 0 + m_PrefilterXRKeywords: 1 + m_PrefilteringModeForwardPlus: 0 + m_PrefilteringModeDeferredRendering: 0 + m_PrefilteringModeScreenSpaceOcclusion: 0 + m_PrefilterDebugKeywords: 1 + m_PrefilterWriteRenderingLayers: 1 + m_PrefilterHDROutput: 1 + m_PrefilterSSAODepthNormals: 1 + m_PrefilterSSAOSourceDepthLow: 1 + m_PrefilterSSAOSourceDepthMedium: 1 + m_PrefilterSSAOSourceDepthHigh: 1 + m_PrefilterSSAOInterleaved: 1 + m_PrefilterSSAOBlueNoise: 1 + m_PrefilterSSAOSampleCountLow: 1 + m_PrefilterSSAOSampleCountMedium: 1 + m_PrefilterSSAOSampleCountHigh: 1 + m_PrefilterDBufferMRT1: 1 + m_PrefilterDBufferMRT2: 1 + m_PrefilterDBufferMRT3: 1 + m_PrefilterSoftShadowsQualityLow: 1 + m_PrefilterSoftShadowsQualityMedium: 1 + m_PrefilterSoftShadowsQualityHigh: 1 m_PrefilterSoftShadows: 0 - m_PrefilterScreenCoord: 0 - m_PrefilterNativeRenderPass: 0 + m_PrefilterScreenCoord: 1 + m_PrefilterNativeRenderPass: 1 m_ShaderVariantLogLevel: 0 m_ShadowCascades: 0 diff --git a/Assets/Resources/Prefabs/DroneTarget.prefab b/Assets/Resources/Prefabs/DroneTarget.prefab index d8dae21..59b78d6 100644 --- a/Assets/Resources/Prefabs/DroneTarget.prefab +++ b/Assets/Resources/Prefabs/DroneTarget.prefab @@ -322,25 +322,7 @@ MonoBehaviour: m_EditorClassIdentifier: _flightPhase: 0 _target: {fileID: 0} - StaticConfig: - accelerationConfig: - maxReferenceAcceleration: 300 - referenceSpeed: 1000 - boostConfig: - boostTime: 0.3 - boostAcceleration: 350 - liftDragConfig: - liftCoefficient: 0.2 - dragCoefficient: 0.7 - liftDragRatio: 5 - bodyConfig: - mass: 0.37 - crossSectionalArea: 0.0003 - finArea: 0.0006 - bodyArea: 0.01 - hitConfig: - hitRadius: 1 - killProbability: 0.9 + staticConfigFile: drone_target.json --- !u!54 &4451965530778273955 Rigidbody: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Prefabs/Hydra70.prefab b/Assets/Resources/Prefabs/Hydra70.prefab index 0a27097..40884e4 100644 --- a/Assets/Resources/Prefabs/Hydra70.prefab +++ b/Assets/Resources/Prefabs/Hydra70.prefab @@ -322,25 +322,7 @@ MonoBehaviour: m_EditorClassIdentifier: _flightPhase: 0 _target: {fileID: 0} - StaticConfig: - accelerationConfig: - maxReferenceAcceleration: 300 - referenceSpeed: 1000 - boostConfig: - boostTime: 0.3 - boostAcceleration: 100 - liftDragConfig: - liftCoefficient: 0.2 - dragCoefficient: 1 - liftDragRatio: 5 - bodyConfig: - mass: 15.8 - crossSectionalArea: 0.004 - finArea: 0.007 - bodyArea: 0.12 - hitConfig: - hitRadius: 1 - killProbability: 0.9 + staticConfigFile: hydra70.json _showDebugVectors: 1 _boostAcceleration: {x: 0, y: 0, z: 0} --- !u!54 &3328180170527195603 diff --git a/Assets/Resources/Prefabs/Micromissile.prefab b/Assets/Resources/Prefabs/Micromissile.prefab index 2093070..ccc17b3 100644 --- a/Assets/Resources/Prefabs/Micromissile.prefab +++ b/Assets/Resources/Prefabs/Micromissile.prefab @@ -322,25 +322,7 @@ MonoBehaviour: m_EditorClassIdentifier: _flightPhase: 0 _target: {fileID: 0} - StaticConfig: - accelerationConfig: - maxReferenceAcceleration: 300 - referenceSpeed: 1000 - boostConfig: - boostTime: 0.3 - boostAcceleration: 350 - liftDragConfig: - liftCoefficient: 0.2 - dragCoefficient: 0.7 - liftDragRatio: 5 - bodyConfig: - mass: 0.37 - crossSectionalArea: 0.0003 - finArea: 0.0006 - bodyArea: 0.01 - hitConfig: - hitRadius: 1 - killProbability: 0.9 + staticConfigFile: micromissile.json _showDebugVectors: 1 _boostAcceleration: {x: 0, y: 0, z: 0} _navigationGain: 5 diff --git a/Assets/Scripts/Agent.cs b/Assets/Scripts/Agent.cs index 7015b4f..52b7a96 100644 --- a/Assets/Scripts/Agent.cs +++ b/Assets/Scripts/Agent.cs @@ -1,8 +1,5 @@ using System.Collections; using System.Collections.Generic; -using TMPro; -using Unity.PlasticSCM.Editor.UI; -using Unity.VisualScripting; using UnityEngine; public abstract class Agent : MonoBehaviour { @@ -22,7 +19,9 @@ public abstract class Agent : MonoBehaviour { protected double _timeInPhase = 0; [SerializeField] - public StaticConfig StaticConfig; + public string staticConfigFile = "generic_static_config.json"; + + protected StaticConfig _staticConfig; // Define delegates public delegate void AgentHitEventHandler(Agent agent); @@ -130,6 +129,10 @@ public abstract class Agent : MonoBehaviour { protected abstract void UpdateBoost(double deltaTime); protected abstract void UpdateMidCourse(double deltaTime); + protected virtual void Awake() { + _staticConfig = ConfigLoader.LoadStaticConfig(staticConfigFile); + } + // Start is called before the first frame update protected virtual void Start() { _flightPhase = FlightPhase.READY; @@ -141,7 +144,7 @@ public abstract class Agent : MonoBehaviour { _timeInPhase += Time.fixedDeltaTime; var launch_time = _agentConfig.dynamic_config.launch_config.launch_time; - var boost_time = launch_time + StaticConfig.boostConfig.boostTime; + var boost_time = launch_time + _staticConfig.boostConfig.boostTime; double elapsedSimulationTime = SimManager.Instance.GetElapsedSimulationTime(); if (_flightPhase == FlightPhase.TERMINATED) { diff --git a/Assets/Scripts/Config/ConfigLoader.cs b/Assets/Scripts/Config/ConfigLoader.cs index 6ecf771..5dc323c 100644 --- a/Assets/Scripts/Config/ConfigLoader.cs +++ b/Assets/Scripts/Config/ConfigLoader.cs @@ -17,6 +17,20 @@ public static class ConfigLoader { } } + public static StaticConfig LoadStaticConfig(string configFileName) { + string configFilePath = Path.Combine(Application.streamingAssetsPath, "Configs/Models", configFileName); + if (File.Exists(configFilePath)) { + string json = File.ReadAllText(configFilePath); + StaticConfig config = JsonConvert.DeserializeObject(json, new JsonSerializerSettings { + Converters = { new Newtonsoft.Json.Converters.StringEnumConverter() } + }); + return config; + } else { + Debug.LogError($"Static configuration file not found at path: {configFilePath}"); + return null; + } + } + public static void PrintSimulationConfig(SimulationConfig config) { if (config == null) diff --git a/Assets/Scripts/Config/StaticConfig.cs b/Assets/Scripts/Config/StaticConfig.cs index b118ee4..d5b65a6 100644 --- a/Assets/Scripts/Config/StaticConfig.cs +++ b/Assets/Scripts/Config/StaticConfig.cs @@ -1,67 +1,43 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; +using System; -[System.Serializable] +[Serializable] public class StaticConfig { - [System.Serializable] + [Serializable] public class AccelerationConfig { - [Tooltip("Maximum reference acceleration")] public float maxReferenceAcceleration = 300f; - [Tooltip("Reference speed")] public float referenceSpeed = 1000f; } - [System.Serializable] + [Serializable] public class BoostConfig { - [Tooltip("Boost time in seconds")] public float boostTime = 0.3f; - [Tooltip("Boost acceleration")] public float boostAcceleration = 350f; } - [System.Serializable] + [Serializable] public class LiftDragConfig { - [Tooltip("Lift coefficient")] public float liftCoefficient = 0.2f; - [Tooltip("Drag coefficient")] public float dragCoefficient = 0.7f; - [Tooltip("Lift to drag ratio")] public float liftDragRatio = 5f; } - [System.Serializable] + [Serializable] public class BodyConfig { - [Tooltip("Mass in kg")] public float mass = 0.37f; - [Tooltip("Cross-sectional area in m²")] public float crossSectionalArea = 3e-4f; - [Tooltip("Fin area in m²")] public float finArea = 6e-4f; - [Tooltip("Body area in m²")] public float bodyArea = 1e-2f; } - [System.Serializable] + [Serializable] public class HitConfig { - [Tooltip("Hit radius")] public float hitRadius = 1f; - [Tooltip("Kill probability")] public float killProbability = 0.9f; } - [Header("Acceleration Configuration")] public AccelerationConfig accelerationConfig; - - [Header("Boost Configuration")] public BoostConfig boostConfig; - - [Header("Lift and Drag Configuration")] public LiftDragConfig liftDragConfig; - - [Header("Body Configuration")] public BodyConfig bodyConfig; - - [Header("Hit Configuration")] public HitConfig hitConfig; } \ No newline at end of file diff --git a/Assets/Scripts/Managers/InputManager.cs b/Assets/Scripts/Managers/InputManager.cs index 258a9c8..bd38615 100644 --- a/Assets/Scripts/Managers/InputManager.cs +++ b/Assets/Scripts/Managers/InputManager.cs @@ -120,8 +120,11 @@ public class InputManager : MonoBehaviour void HandleNonLockableInput() { HandleScrollWheelInput(); - if (Input.GetKeyDown(KeyCode.I)) + if(Input.GetKeyDown(KeyCode.Escape)) + { + Application.Quit(); + } if (Input.GetKeyDown(KeyCode.C)) { diff --git a/Assets/Scripts/Missile.cs b/Assets/Scripts/Missile.cs index f94a5ea..e1c4221 100644 --- a/Assets/Scripts/Missile.cs +++ b/Assets/Scripts/Missile.cs @@ -22,7 +22,7 @@ public class Missile : Agent { // Unassign the target from the missile. public override void UnassignTarget() { base.UnassignTarget(); - } + } protected override void UpdateReady(double deltaTime) { Vector3 accelerationInput = Vector3.zero; @@ -43,7 +43,7 @@ public class Missile : Agent { // Calculate boost acceleration float boostAcceleration = - (float)(StaticConfig.boostConfig.boostAcceleration * Constants.kGravity); + (float)(_staticConfig.boostConfig.boostAcceleration * Constants.kGravity); Vector3 accelerationInput = boostAcceleration * rollAxis; // Calculate the total acceleration @@ -81,7 +81,7 @@ public class Missile : Agent { Agent otherAgent = other.gameObject.GetComponentInParent(); if (otherAgent != null && otherAgent.GetComponent() != null) { // Check kill probability before marking as hit - float killProbability = StaticConfig.hitConfig.killProbability; + float killProbability = _staticConfig.hitConfig.killProbability; GameObject markerObject = Instantiate(Resources.Load("Prefabs/HitMarkerPrefab"), transform.position, Quaternion.identity); if (Random.value <= killProbability) { @@ -102,8 +102,8 @@ public class Missile : Agent { protected float CalculateMaxAcceleration() { float maxReferenceAcceleration = - (float)(StaticConfig.accelerationConfig.maxReferenceAcceleration * Constants.kGravity); - float referenceSpeed = StaticConfig.accelerationConfig.referenceSpeed; + (float)(_staticConfig.accelerationConfig.maxReferenceAcceleration * Constants.kGravity); + float referenceSpeed = _staticConfig.accelerationConfig.referenceSpeed; return Mathf.Pow(GetComponent().velocity.magnitude / referenceSpeed, 2) * maxReferenceAcceleration; } @@ -122,9 +122,9 @@ public class Missile : Agent { } private float CalculateDrag() { - float dragCoefficient = StaticConfig.liftDragConfig.dragCoefficient; - float crossSectionalArea = StaticConfig.bodyConfig.crossSectionalArea; - float mass = StaticConfig.bodyConfig.mass; + float dragCoefficient = _staticConfig.liftDragConfig.dragCoefficient; + float crossSectionalArea = _staticConfig.bodyConfig.crossSectionalArea; + float mass = _staticConfig.bodyConfig.mass; float dynamicPressure = (float)GetDynamicPressure(); float dragForce = dragCoefficient * dynamicPressure * crossSectionalArea; return dragForce / mass; @@ -133,7 +133,7 @@ public class Missile : Agent { private float CalculateLiftInducedDrag(Vector3 accelerationInput) { float liftAcceleration = (accelerationInput - Vector3.Dot(accelerationInput, transform.up) * transform.up).magnitude; - float liftDragRatio = StaticConfig.liftDragConfig.liftDragRatio; + float liftDragRatio = _staticConfig.liftDragConfig.liftDragRatio; return Mathf.Abs(liftAcceleration / liftDragRatio); } diff --git a/Assets/StreamingAssets/Configs/Models.meta b/Assets/StreamingAssets/Configs/Models.meta new file mode 100644 index 0000000..9d6ae32 --- /dev/null +++ b/Assets/StreamingAssets/Configs/Models.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d896f75c5d864994b9d88c2da1515a52 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/Configs/Models/drone_target.json b/Assets/StreamingAssets/Configs/Models/drone_target.json new file mode 100644 index 0000000..d4c81cd --- /dev/null +++ b/Assets/StreamingAssets/Configs/Models/drone_target.json @@ -0,0 +1,25 @@ +{ + "accelerationConfig": { + "maxReferenceAcceleration": 300, + "referenceSpeed": 1000 + }, + "boostConfig": { + "boostTime": 0.3, + "boostAcceleration": 350 + }, + "liftDragConfig": { + "liftCoefficient": 0.2, + "dragCoefficient": 0.7, + "liftDragRatio": 5 + }, + "bodyConfig": { + "mass": 0.37, + "crossSectionalArea": 0.0003, + "finArea": 0.0006, + "bodyArea": 0.01 + }, + "hitConfig": { + "hitRadius": 1, + "killProbability": 0.9 + } +} \ No newline at end of file diff --git a/Assets/StreamingAssets/Configs/Models/drone_target.json.meta b/Assets/StreamingAssets/Configs/Models/drone_target.json.meta new file mode 100644 index 0000000..e633a32 --- /dev/null +++ b/Assets/StreamingAssets/Configs/Models/drone_target.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1a7820df17edabd4aa31868d2fd396a6 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/Configs/Models/hydra70.json b/Assets/StreamingAssets/Configs/Models/hydra70.json new file mode 100644 index 0000000..699f66c --- /dev/null +++ b/Assets/StreamingAssets/Configs/Models/hydra70.json @@ -0,0 +1,25 @@ +{ + "accelerationConfig": { + "maxReferenceAcceleration": 300, + "referenceSpeed": 1000 + }, + "boostConfig": { + "boostTime": 0.3, + "boostAcceleration": 100 + }, + "liftDragConfig": { + "liftCoefficient": 0.2, + "dragCoefficient": 1, + "liftDragRatio": 5 + }, + "bodyConfig": { + "mass": 15.8, + "crossSectionalArea": 0.004, + "finArea": 0.007, + "bodyArea": 0.12 + }, + "hitConfig": { + "hitRadius": 1, + "killProbability": 0.9 + } +} \ No newline at end of file diff --git a/Assets/StreamingAssets/Configs/Models/hydra70.json.meta b/Assets/StreamingAssets/Configs/Models/hydra70.json.meta new file mode 100644 index 0000000..937be6c --- /dev/null +++ b/Assets/StreamingAssets/Configs/Models/hydra70.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3a8f5736c9337c84a9871d02d98bdae2 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/Configs/Models/micromissile.json b/Assets/StreamingAssets/Configs/Models/micromissile.json new file mode 100644 index 0000000..a7f432d --- /dev/null +++ b/Assets/StreamingAssets/Configs/Models/micromissile.json @@ -0,0 +1,25 @@ +{ + "accelerationConfig": { + "maxReferenceAcceleration": 300, + "referenceSpeed": 1000 + }, + "boostConfig": { + "boostTime": 0.3, + "boostAcceleration": 350 + }, + "liftDragConfig": { + "liftCoefficient": 0.2, + "dragCoefficient": 0.7, + "liftDragRatio": 5 + }, + "bodyConfig": { + "mass": 0.37, + "crossSectionalArea": 0.0003, + "finArea": 0.0006, + "bodyArea": 0.01 + }, + "hitConfig": { + "hitRadius": 1, + "killProbability": 0.9 + } +} \ No newline at end of file diff --git a/Assets/StreamingAssets/Configs/Models/micromissile.json.meta b/Assets/StreamingAssets/Configs/Models/micromissile.json.meta new file mode 100644 index 0000000..103d8ae --- /dev/null +++ b/Assets/StreamingAssets/Configs/Models/micromissile.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 54835a0f75efb1041a19e5fa8d9c2de3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 0147887..bc510c0 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -4,5 +4,8 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 - m_Scenes: [] + m_Scenes: + - enabled: 1 + path: Assets/Scenes/MainScene.unity + guid: 9fc0d4010bbf28b4594072e72b8655ab m_configObjects: {} diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index b79983c..283277a 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -12,7 +12,7 @@ PlayerSettings: targetDevice: 2 useOnDemandResources: 0 accelerometerFrequency: 60 - companyName: DefaultCompany + companyName: BAMLAB productName: micromissiles defaultCursor: {fileID: 0} cursorHotspot: {x: 0, y: 0} @@ -92,7 +92,7 @@ PlayerSettings: bakeCollisionMeshes: 0 forceSingleInstance: 0 useFlipModelSwapchain: 1 - resizableWindow: 0 + resizableWindow: 1 useMacAppStoreValidation: 0 macAppStoreCategory: public.app-category.games gpuSkinning: 1 @@ -103,7 +103,7 @@ PlayerSettings: xboxEnableFitness: 0 visibleInBackground: 1 allowFullscreenSwitch: 1 - fullscreenMode: 1 + fullscreenMode: 3 xboxSpeechDB: 0 xboxEnableHeadOrientation: 0 xboxEnableGuest: 0 @@ -160,7 +160,8 @@ PlayerSettings: resetResolutionOnWindowResize: 0 androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 - applicationIdentifier: {} + applicationIdentifier: + Standalone: com.BAMLAB.micromissiles buildNumber: Standalone: 0 VisionOS: 0 @@ -282,7 +283,14 @@ PlayerSettings: AndroidMinifyDebug: 0 AndroidValidateAppBundleSize: 1 AndroidAppBundleSizeToValidate: 150 - m_BuildTargetIcons: [] + m_BuildTargetIcons: + - m_BuildTarget: + m_Icons: + - serializedVersion: 2 + m_Icon: {fileID: 2800000, guid: 799154081e756314d8bf09b6c74bcde7, type: 3} + m_Width: 128 + m_Height: 128 + m_Kind: 0 m_BuildTargetPlatformIcons: [] m_BuildTargetBatching: - m_BuildTarget: Standalone