| | | 1 | | using System; |
| | | 2 | | using UnityEngine; |
| | | 3 | | |
| | | 4 | | public abstract class Sensor : MonoBehaviour { |
| | | 5 | | protected Agent _agent; |
| | | 6 | | |
| | 16 | 7 | | protected virtual void Start() { |
| | 16 | 8 | | _agent = GetComponent<Agent>(); |
| | 16 | 9 | | } |
| | | 10 | | |
| | | 11 | | /// Main sensing method to gather information about a target agent. |
| | | 12 | | /// Returns the sensor output containing the sensed position and velocity. |
| | | 13 | | public abstract SensorOutput Sense(Agent agent); |
| | | 14 | | |
| | | 15 | | /// Main sensing method to gather information about a waypoint. |
| | | 16 | | /// Returns the sensor output containing the sensed position and velocity. |
| | | 17 | | public abstract SensorOutput SenseWaypoint(Vector3 waypoint); |
| | | 18 | | } |
| | | 19 | | |
| | | 20 | | public struct SensorOutput { |
| | | 21 | | public PositionTransformation position; |
| | | 22 | | public VelocityTransformation velocity; |
| | | 23 | | } |