using UnityEngine;
namespace Unity.MLAgents.Sensors
{
///
/// A SensorComponent that creates a .
///
[AddComponentMenu("ML Agents/Vector Sensor", (int)MenuGroup.Sensors)]
public class VectorSensorComponent : SensorComponent
{
///
/// Name of the generated object.
/// Note that changing this at runtime does not affect how the Agent sorts the sensors.
///
public string SensorName
{
get { return m_SensorName; }
set { m_SensorName = value; }
}
[HideInInspector, SerializeField]
private string m_SensorName = "VectorSensor";
///
/// The number of float observations in the VectorSensor
///
public int ObservationSize
{
get { return m_ObservationSize; }
set { m_ObservationSize = value; }
}
[HideInInspector, SerializeField]
int m_ObservationSize;
[HideInInspector, SerializeField]
ObservationType m_ObservationType;
VectorSensor m_Sensor;
///
/// The type of the observation.
///
public ObservationType ObservationType
{
get { return m_ObservationType; }
set { m_ObservationType = value; }
}
///
/// Creates a VectorSensor.
///
///
public override ISensor[] CreateSensors()
{
m_Sensor = new VectorSensor(m_ObservationSize, m_SensorName, m_ObservationType);
return new ISensor[] { m_Sensor };
}
///
/// Returns the underlying VectorSensor
///
///
public VectorSensor GetSensor()
{
return m_Sensor;
}
}
}