Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
DistanceSensor.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  public class DistanceSensor : Sensor,
11  IHasSingle {
12  [SerializeField] UnityEngine.Transform t1 = null;
13  [SerializeField] UnityEngine.Transform t2 = null;
14  [SerializeField] float _observationValue = 0;
15 
16  public override IEnumerable<float> FloatEnumerable { get { return new[] {this.ObservationValue}; } }
17 
18  public override void UpdateObservation() {
19  this.ObservationValue = Vector3.Distance(this.t1.position, this.t2.position);
20  }
21 
22  public float ObservationValue {
23  get { return this._observationValue; }
24  private set { this._observationValue = value; }
25  }
26 
27  public Space1 SingleSpace { get; }
28  }
29 }