Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
BoundingBoxSensor.cs
Go to the documentation of this file.
1 using System.Collections.Generic;
3 using UnityEngine;
4 
5 namespace droid.Runtime.Prototyping.Sensors.BoundingBox {
9  [AddComponentMenu(SensorComponentMenuPath._ComponentMenuPath
10  + "Experimental/BoundingBox"
11  + SensorComponentMenuPath._Postfix)]
12  [ExecuteInEditMode]
13  [RequireComponent(typeof(Utilities.GameObjects.BoundingBoxes.BoundingBox))]
14  public class BoundingBoxSensor : Sensor,
15  IHasString {
19  public override string PrototypingTypeName { get { return "BoundingBox"; } }
20 
21  Utilities.GameObjects.BoundingBoxes.BoundingBox _bounding_box;
22  [SerializeField] string _observationValue;
23 
27  protected override void PreSetup() {
28  this._bounding_box = this.GetComponent<Utilities.GameObjects.BoundingBoxes.BoundingBox>();
29  }
30 
34  public override IEnumerable<float> FloatEnumerable { get { return new List<float>(); } }
35 
39  public override void UpdateObservation() {
40  this.ObservationValue = this._bounding_box.BoundingBoxCoordinatesWorldSpaceAsJson;
41  }
42 
46  public string ObservationValue {
47  get { return this._observationValue; }
48  set { this._observationValue = value; }
49  }
50 
51  public override string ToString() { return this.ObservationValue; }
52  }
53 }