| | | 1 | | using UnityEngine; |
| | | 2 | | |
| | | 3 | | // Base implementation of an attack behavior. |
| | | 4 | | public abstract class AttackBehaviorBase : IAttackBehavior { |
| | | 5 | | // Attack behavior configuration. |
| | | 6 | | private Configs.AttackBehaviorConfig _config; |
| | | 7 | | |
| | | 8 | | // Flight plan. |
| | | 9 | | private FlightPlan _flightPlan; |
| | | 10 | | |
| | | 11 | | // Agent that will execute the attack behavior. |
| | 12 | 12 | | public IAgent Agent { get; init; } |
| | | 13 | | |
| | | 14 | | public Configs.AttackBehaviorConfig Config { |
| | 6 | 15 | | get => _config; |
| | 6 | 16 | | init => _config = value; |
| | | 17 | | } |
| | | 18 | | |
| | | 19 | | public FlightPlan FlightPlan { |
| | 48 | 20 | | get { |
| | 54 | 21 | | if (_flightPlan == null) { |
| | 6 | 22 | | _flightPlan = new FlightPlan(Config?.FlightPlan); |
| | 6 | 23 | | } |
| | 48 | 24 | | return _flightPlan; |
| | 48 | 25 | | } |
| | | 26 | | } |
| | | 27 | | |
| | 12 | 28 | | public AttackBehaviorBase(IAgent agent, Configs.AttackBehaviorConfig config) { |
| | 6 | 29 | | Agent = agent; |
| | 6 | 30 | | Config = config; |
| | 6 | 31 | | } |
| | | 32 | | |
| | | 33 | | // Return the next waypoint for the agent to navigate to and the power setting to use towards the |
| | | 34 | | // waypoint. |
| | | 35 | | public abstract (Vector3 waypointPosition, Configs.Power power) |
| | | 36 | | GetNextWaypoint(in Vector3 targetPosition); |
| | | 37 | | } |