Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
ValueSensor.cs
Go to the documentation of this file.
1 using System.Collections.Generic;
4 using UnityEngine;
5 
6 namespace droid.Runtime.Prototyping.Sensors.Experimental {
10  [AddComponentMenu(SensorComponentMenuPath._ComponentMenuPath + "Value" + SensorComponentMenuPath._Postfix)]
11  [ExecuteInEditMode]
12  public class ValueSensor : Sensor,
13  IHasSingle {
14  [Header("Observation", order = 103)]
15  [SerializeField]
16  float _observation_value;
17 
18  [SerializeField] Space1 _observation_value_space;
19 
23  public Space1 SingleSpace { get { return this._observation_value_space; } }
24 
28  public float ObservationValue {
29  get { return this._observation_value; }
30  set {
31  this._observation_value = this.SingleSpace.IsNormalised
32  ? this._observation_value_space.ClipNormaliseRound(value)
33  : value;
34  }
35  }
36 
40  protected override void PreSetup() { }
41 
45  public override IEnumerable<float> FloatEnumerable { get { return new[] {this.ObservationValue}; } }
49  public override void UpdateObservation() { ; }
50  }
51 }