Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
TargetRigidbodySensor.cs
Go to the documentation of this file.
1 using System.Collections.Generic;
5 using UnityEngine;
6 using UnityEngine.Serialization;
7 
8 namespace droid.Runtime.Prototyping.Sensors.Experimental {
12  public class TargetRigidbodySensor : Sensor,
13  IHasDouble {
14 
15  [SerializeField]
16  TargetRigidbodyActuator _actuator = null;
17 
18  [SerializeField] Space2 _observation_space2_d = Space2.ZeroOne;
19 
23  public Vector2 ObservationValue {
24  get { return new Vector2(this._actuator.MovementSpeed, this._actuator.RotationSpeed); }
25  }
26 
30  public Space2 DoubleSpace { get { return this._observation_space2_d; } }
31 
35  protected override void PreSetup() {
36  base.PreSetup();
37  if (!this._actuator) {
38  this._actuator = this.GetComponent<TargetRigidbodyActuator>();
39  }
40  }
41 
42  public override IEnumerable<float> FloatEnumerable {
43  get { return new[] {this.ObservationValue.x, this.ObservationValue.y}; }
44  }
45 
49  public override void UpdateObservation() { }
50  }
51 }