23 lines
672 B
C#
23 lines
672 B
C#
using UnityEngine;
|
|
using NanoBrain;
|
|
using CreatureControl;
|
|
|
|
public class AntennaTouch : MonoBehaviour {
|
|
public Neuron receptor;
|
|
public Insect insect;
|
|
|
|
protected virtual void Awake() {
|
|
this.insect = GetComponentInParent<Insect>();
|
|
}
|
|
|
|
void OnTriggerStay(Collider other) {
|
|
Vector3 touchDirection = this.insect.transform.InverseTransformVector(this.transform.forward);
|
|
receptor?.SetBias(touchDirection);
|
|
}
|
|
// Perhaps I can leave this out and use the sleep state?
|
|
void OnTriggerExit(Collider other) {
|
|
Vector3 touchDirection = Vector3.zero;
|
|
receptor?.SetBias(touchDirection);
|
|
}
|
|
}
|