2 using System.Collections.Generic;
7 namespace droid.Runtime.Prototyping.Sensors.Rays {
11 [AddComponentMenu(SensorComponentMenuPath._ComponentMenuPath
13 + SensorComponentMenuPath._Postfix)]
18 RaycastHit _hit =
new RaycastHit();
20 [SerializeField]
float _obs_value = 0;
27 [Header(
"Specific", order = 102)]
31 public override string PrototypingTypeName {
get {
return "LineOfSight"; } }
33 public float ObservationValue {
get {
return this._obs_value; }
private set { this._obs_value = value; } }
35 public Space1 SingleSpace {
get {
return this._observation_value_space; } }
39 public override IEnumerable<float> FloatEnumerable {
get {
return new[] {this.ObservationValue}; } }
42 var distance = Vector3.Distance(this.transform.position,
this._target.position);
43 if (Physics.Raycast(
this.transform.position,
44 this._target.position -
this.transform.position,
49 Debug.Log(this._hit.distance);
53 if (this._hit.collider.gameObject !=
this._target.gameObject) {
54 this.ObservationValue = 0;
56 this.ObservationValue = 1;
59 this.ObservationValue = 1;
override void UpdateObservation()