| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | // Launch planner output. |
| | 4 | | public class LaunchPlan { |
| | 5 | | // No-launch launch plan. |
| 0 | 6 | | public static LaunchPlan NoLaunch = new LaunchPlan(); |
| | 7 | |
|
| | 8 | | // Whether the interceptor should be launched. |
| 0 | 9 | | public bool ShouldLaunch { get; } |
| | 10 | |
|
| | 11 | | // Launch angle in degrees measured from the horizon. |
| 0 | 12 | | public float LaunchAngle { get; } |
| | 13 | |
|
| | 14 | | // Intercept position. |
| 0 | 15 | | public Vector3 InterceptPosition { get; } |
| | 16 | |
|
| 0 | 17 | | public LaunchPlan() { |
| 0 | 18 | | ShouldLaunch = false; |
| 0 | 19 | | } |
| 0 | 20 | | public LaunchPlan(float launchAngle, Vector3 interceptPosition, bool shouldLaunch = true) { |
| 0 | 21 | | LaunchAngle = launchAngle; |
| 0 | 22 | | InterceptPosition = interceptPosition; |
| 0 | 23 | | ShouldLaunch = shouldLaunch; |
| 0 | 24 | | } |
| | 25 | | } |
| | 26 | |
|
| | 27 | | // The launch planner class is an interface for planning when and where to launch an interceptor to |
| | 28 | | // intercept a target. |
| | 29 | | public abstract class ILaunchPlanner { |
| | 30 | | // Launch angle planner. |
| | 31 | | protected ILaunchAnglePlanner _launchAnglePlanner; |
| | 32 | |
|
| | 33 | | // Agent trajectory predictor. |
| | 34 | | protected IPredictor _predictor; |
| | 35 | |
|
| | 36 | | public ILaunchPlanner(ILaunchAnglePlanner launchAnglePlanner, IPredictor predictor) { |
| | 37 | | _launchAnglePlanner = launchAnglePlanner; |
| | 38 | | _predictor = predictor; |
| | 39 | | } |
| | 40 | |
|
| | 41 | | // Plan the launch. |
| | 42 | | public abstract LaunchPlan Plan(); |
| | 43 | | } |