9 namespace droid.Runtime.Prototyping.Evaluation {
28 [AddComponentMenu(EvaluationComponentMenuPath._ComponentMenuPath
30 + EvaluationComponentMenuPath._Postfix)]
32 [SerializeField] Collider _actor = null;
34 [SerializeField] Collider _area = null;
36 [SerializeField]
bool _based_on_tags =
false;
63 this.ParentEnvironment.Terminate(
"Inside goal area");
68 this.ParentEnvironment.Terminate(
"Actor colliding with obstruction");
71 if (this._playable_area && this._actor) {
72 if (!this._playable_area.
Bounds.Intersects(
this._actor.GetComponent<Collider>().bounds)) {
73 this.ParentEnvironment.Terminate(
"Actor is outside playable area");
82 this._area = FindObjectOfType<Sensor>().gameObject.GetComponent<Collider>();
86 this._actor = FindObjectOfType<Actor>().gameObject.GetComponent<Collider>();
89 if (this._obstructions.Length <= 0) {
90 this._obstructions = FindObjectsOfType<Obstruction>();
93 if (!this._playable_area) {
94 this._playable_area = FindObjectOfType<BoundingBox>();
103 .OnCollisionEnterChild,
105 .OnTriggerEnterChild,
107 .OnCollisionExitChild,
111 .OnCollisionStayChild,
113 .OnTriggerStayChild);
121 .OnCollisionEnterChild,
123 .OnTriggerEnterChild,
125 .OnCollisionExitChild,
129 .OnCollisionStayChild,
131 .OnTriggerStayChild);
134 void OnTriggerEnterChild(GameObject child_game_object, Collider other_game_object) {
136 if (this._based_on_tags) {
137 if (child_game_object.CompareTag(
this._area.tag) && other_game_object.CompareTag(this._actor.tag)) {
139 if (this.Debugging) {
140 Debug.Log(
"Actor is inside area");
147 if (child_game_object.CompareTag(
this._actor.tag) && other_game_object.CompareTag(
"Obstruction")) {
149 if (this.Debugging) {
150 Debug.Log(
"Actor is colliding");
157 if (child_game_object == this._area.gameObject
158 && other_game_object.gameObject ==
this._actor.gameObject) {
160 if (this.Debugging) {
161 Debug.Log(
"Actor is inside area");
168 if (child_game_object == this._actor.gameObject && other_game_object.CompareTag(
"Obstruction")) {
170 if (this.Debugging) {
171 Debug.Log(
"Actor is colliding");
181 void OnTriggerStayChild(GameObject child_game_object, Collider other_game_object) {
183 if (this._based_on_tags) {
184 if (child_game_object.CompareTag(
this._area.tag) && other_game_object.CompareTag(this._actor.tag)) {
186 if (this.Debugging) {
187 Debug.Log(
"Actor is inside area");
194 if (child_game_object.CompareTag(
this._actor.tag) && other_game_object.CompareTag(
"Obstruction")) {
196 if (this.Debugging) {
197 Debug.Log(
"Actor is colliding");
204 if (child_game_object == this._area.gameObject
205 && other_game_object.gameObject ==
this._actor.gameObject) {
207 if (this.Debugging) {
208 Debug.Log(
"Actor is inside area");
215 if (child_game_object == this._actor.gameObject && other_game_object.CompareTag(
"Obstruction")) {
217 if (this.Debugging) {
218 Debug.Log(
"Actor is colliding");
228 void OnTriggerExitChild(GameObject child_game_object, Collider other_game_object) {
230 if (this._based_on_tags) {
231 if (child_game_object.CompareTag(
this._area.tag) && other_game_object.CompareTag(this._actor.tag)) {
233 if (this.Debugging) {
234 Debug.Log(
"Actor is outside area");
241 if (child_game_object.CompareTag(
this._actor.tag) && other_game_object.CompareTag(
"Obstruction")) {
243 if (this.Debugging) {
244 Debug.Log(
"Actor is not colliding");
251 if (child_game_object == this._area.gameObject
252 && other_game_object.gameObject ==
this._actor.gameObject) {
254 if (this.Debugging) {
255 Debug.Log(
"Actor is outside area");
262 if (child_game_object == this._actor.gameObject && other_game_object.CompareTag(
"Obstruction")) {
264 if (this.Debugging) {
265 Debug.Log(
"Actor is not colliding");
275 void OnCollisionEnterChild(GameObject child_game_object, Collision collision) { }
277 void OnCollisionStayChild(GameObject child_game_object, Collision collision) { }
279 void OnCollisionExitChild(GameObject child_game_object, Collision collision) { }
override void PostSetup()
override void InternalReset()
override float InternalEvaluate()