File size: 812 Bytes
05c9ac2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using UnityEngine;
using Unity.MLAgents.Sensors;


public class TestTextureSensorComponent : SensorComponent
{
    TestTextureSensor m_Sensor;

    public Texture2D TestTexture;

    string m_SensorName = "TextureSensor";

    public string SensorName
    {
        get { return m_SensorName; }
        set { m_SensorName = value; }
    }


    public int ObservationStacks = 4;

    public SensorCompressionType CompressionType = SensorCompressionType.PNG;


    /// <inheritdoc/>
    public override ISensor[] CreateSensors()
    {
        m_Sensor = new TestTextureSensor(TestTexture, SensorName, CompressionType);
        if (ObservationStacks != 1)
        {
            return new ISensor[] { new StackingSensor(m_Sensor, ObservationStacks) };
        }
        return new ISensor[] { m_Sensor };
    }
}