Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
EuclideanDistance.cs
Go to the documentation of this file.
2 using UnityEngine;
3 
4 namespace droid.Runtime.Prototyping.Evaluation {
5  [AddComponentMenu(EvaluationComponentMenuPath._ComponentMenuPath
6  + "EuclideanDistance"
7  + EvaluationComponentMenuPath._Postfix)]
9  [SerializeField] Transform _g1;
10  [SerializeField] Transform _g2;
11 
12  public override void InternalReset() { }
13 
14  public override float InternalEvaluate() {
15  return Vector3.Distance(this._g1.position, this._g2.position);
16  }
17 
18  protected override void PostSetup() {
19  if (this._g1 == null) {
20  this._g1 = FindObjectOfType<Actor>().transform;
21  }
22 
23  if (this._g2 == null) {
24  this._g2 = this.transform;
25  }
26  }
27  }
28 }