"target_type" -> "threat_type", truncate sim config JSON
This commit is contained in:
@@ -66,7 +66,7 @@ public static class ConfigLoader {
|
||||
{
|
||||
Debug.Log(" Agent Configuration:");
|
||||
Debug.Log($" Interceptor Type: {agentConfig.interceptor_type}");
|
||||
Debug.Log($" Threat Type: {agentConfig.target_type}");
|
||||
Debug.Log($" Threat Type: {agentConfig.threat_type}");
|
||||
PrintInitialState(agentConfig.initial_state);
|
||||
PrintStandardDeviation(agentConfig.standard_deviation);
|
||||
PrintDynamicConfig(agentConfig.dynamic_config);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SwarmConfig {
|
||||
[Serializable]
|
||||
public class AgentConfig {
|
||||
public InterceptorType interceptor_type;
|
||||
public ThreatType target_type;
|
||||
public ThreatType threat_type;
|
||||
public InitialState initial_state;
|
||||
public StandardDeviation standard_deviation;
|
||||
public DynamicConfig dynamic_config;
|
||||
@@ -47,7 +47,7 @@ public class AgentConfig {
|
||||
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 = ThreatType.DRONE, // Or another default value
|
||||
threat_type = ThreatType.DRONE, // Or another default value
|
||||
submunitions_config = null // Or a default value if needed
|
||||
};
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class SensorConfig {
|
||||
|
||||
[Serializable]
|
||||
public class TargetConfig {
|
||||
public ThreatType target_type;
|
||||
public ThreatType threat_type;
|
||||
public InitialState initial_state;
|
||||
public PlottingConfig plotting_config;
|
||||
public string prefabName;
|
||||
|
||||
@@ -224,9 +224,9 @@ public class SimManager : MonoBehaviour {
|
||||
/// <param name="config">Configuration settings for the threat.</param>
|
||||
/// <returns>The created Threat instance, or null if creation failed.</returns>
|
||||
private Threat CreateThreat(AgentConfig config) {
|
||||
string prefabName = config.target_type switch {
|
||||
string prefabName = config.threat_type switch {
|
||||
ThreatType.DRONE => "Drone", ThreatType.ANTISHIP_MISSILE => "AntishipMissile",
|
||||
_ => throw new System.ArgumentException($"Unsupported threat type: {config.target_type}")
|
||||
_ => throw new System.ArgumentException($"Unsupported threat type: {config.threat_type}")
|
||||
};
|
||||
GameObject threatObject = CreateAgent(config, prefabName);
|
||||
if (threatObject == null)
|
||||
@@ -238,7 +238,7 @@ public class SimManager : MonoBehaviour {
|
||||
|
||||
// Assign a unique and simple ID
|
||||
int targetId = _threats.Count;
|
||||
threatObject.name = $"{config.target_type}_Target_{targetId}";
|
||||
threatObject.name = $"{config.threat_type}_Target_{targetId}";
|
||||
return threatObject.GetComponent<Threat>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user