2024-09-12 00:17:21 -07:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
[CreateAssetMenu(fileName = "SimulationConfig", menuName = "Simulation/Config", order = 1)]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class SimulationConfig : ScriptableObject {
|
|
|
|
[Header("Simulation Settings")]
|
|
|
|
public float timeScale = 0.05f;
|
2024-09-12 00:17:21 -07:00
|
|
|
|
2024-09-13 22:45:25 -07:00
|
|
|
[Header("Missile Swarm Configurations")]
|
|
|
|
public List<SwarmConfig> missile_swarm_configs = new List<SwarmConfig>();
|
2024-09-12 00:17:21 -07:00
|
|
|
|
2024-09-13 22:45:25 -07:00
|
|
|
[Header("Target Swarm Configurations")]
|
|
|
|
public List<SwarmConfig> target_swarm_configs = new List<SwarmConfig>();
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class DynamicConfig {
|
|
|
|
public LaunchConfig launch_config;
|
|
|
|
public SensorConfig sensor_config;
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class SwarmConfig {
|
|
|
|
public int num_agents;
|
|
|
|
public AgentConfig agent_config;
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class AgentConfig {
|
|
|
|
public MissileType missile_type;
|
|
|
|
public TargetType target_type;
|
|
|
|
public InitialState initial_state;
|
|
|
|
public StandardDeviation standard_deviation;
|
|
|
|
public DynamicConfig dynamic_config;
|
|
|
|
public PlottingConfig plotting_config;
|
|
|
|
public SubmunitionsConfig submunitions_config;
|
|
|
|
|
|
|
|
public static AgentConfig FromSubmunitionAgentConfig(SubmunitionAgentConfig submunitionConfig) {
|
|
|
|
return new AgentConfig {
|
|
|
|
missile_type = submunitionConfig.missile_type,
|
|
|
|
initial_state = submunitionConfig.initial_state,
|
|
|
|
standard_deviation = submunitionConfig.standard_deviation,
|
|
|
|
dynamic_config = submunitionConfig.dynamic_config,
|
|
|
|
plotting_config = submunitionConfig.plotting_config,
|
|
|
|
|
|
|
|
// Set other fields as needed, using default values if not present in SubmunitionAgentConfig
|
|
|
|
target_type = TargetType.DRONE, // Or another default value
|
|
|
|
submunitions_config = null // Or a default value if needed
|
|
|
|
};
|
|
|
|
}
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class InitialState {
|
|
|
|
public Vector3 position;
|
|
|
|
public Vector3 rotation;
|
|
|
|
public Vector3 velocity;
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class StandardDeviation {
|
|
|
|
public Vector3 position;
|
|
|
|
public Vector3 velocity;
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class LaunchConfig {
|
|
|
|
public float launch_time;
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class PlottingConfig {
|
|
|
|
public Color color;
|
|
|
|
public LineStyle linestyle;
|
|
|
|
public Marker marker;
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class SubmunitionsConfig {
|
|
|
|
public int num_submunitions;
|
|
|
|
public LaunchConfig launch_config;
|
|
|
|
public SubmunitionAgentConfig agent_config;
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class SubmunitionAgentConfig {
|
|
|
|
public MissileType missile_type;
|
|
|
|
public InitialState initial_state;
|
|
|
|
public StandardDeviation standard_deviation;
|
|
|
|
public DynamicConfig dynamic_config;
|
|
|
|
public PlottingConfig plotting_config;
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class SensorConfig {
|
|
|
|
public SensorType type;
|
|
|
|
public float frequency;
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
2024-09-13 22:45:25 -07:00
|
|
|
public class TargetConfig {
|
|
|
|
public TargetType target_type;
|
|
|
|
public InitialState initial_state;
|
|
|
|
public PlottingConfig plotting_config;
|
|
|
|
public string prefabName;
|
2024-09-12 00:17:21 -07:00
|
|
|
}
|
|
|
|
|
2024-09-13 22:45:25 -07:00
|
|
|
public enum MissileType { HYDRA_70, MICROMISSILE }
|
2024-09-12 00:17:21 -07:00
|
|
|
|
2024-09-13 22:45:25 -07:00
|
|
|
public enum TargetType { DRONE, MISSILE }
|
2024-09-12 00:17:21 -07:00
|
|
|
|
2024-09-13 22:45:25 -07:00
|
|
|
public enum ConfigColor { BLUE, GREEN, RED }
|
2024-09-12 00:17:21 -07:00
|
|
|
|
2024-09-13 22:45:25 -07:00
|
|
|
public enum LineStyle { DOTTED, SOLID }
|
2024-09-12 00:17:21 -07:00
|
|
|
|
2024-09-13 22:45:25 -07:00
|
|
|
public enum Marker { TRIANGLE_UP, TRIANGLE_DOWN, SQUARE }
|
2024-09-12 00:17:21 -07:00
|
|
|
|
2024-09-13 22:45:25 -07:00
|
|
|
public enum SensorType { IDEAL }
|