| | 1 | | using System; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | public abstract class Sensor : MonoBehaviour { |
| | 5 | | protected Agent _agent; |
| | 6 | |
|
| 8 | 7 | | protected virtual void Start() { |
| 8 | 8 | | _agent = GetComponent<Agent>(); |
| 8 | 9 | | } |
| | 10 | |
|
| | 11 | | /// <summary> |
| | 12 | | /// Main sensing method to gather information about a target agent. |
| | 13 | | /// </summary> |
| | 14 | | /// <param name="agent">The agent to sense.</param> |
| | 15 | | /// <returns>SensorOutput containing position and velocity data.</returns> |
| | 16 | | public abstract SensorOutput Sense(Agent agent); |
| | 17 | |
|
| | 18 | | /// <summary> |
| | 19 | | /// Main sensing method to gather information about a waypoint. |
| | 20 | | /// </summary> |
| | 21 | | /// <param name="waypoint">The waypoint to sense.</param> |
| | 22 | | /// <returns>SensorOutput containing position and velocity data.</returns> |
| | 23 | | public abstract SensorOutput SenseWaypoint(Vector3 waypoint); |
| | 24 | | } |
| | 25 | |
|
| | 26 | | public struct SensorOutput { |
| | 27 | | public PositionTransformation position; |
| | 28 | | public VelocityTransformation velocity; |
| | 29 | | } |