using System.Collections; using System.Collections.Generic; using UnityEngine; public abstract class Threat : Agent { /// /// Strategy for moving the Threat towards a predefined target. /// public abstract class NavigationStrategy { /// /// Execute one timestep of the strategy for the given threat and flight phase. Should only /// apply normal forces to the threat. Can also change the threat's flight phase. Should NOT /// manage thrust. /// /// Parent Threat object /// List of other threats in the swarm /// Current flight phase /// List of active interceptors /// Timestep public abstract void Execute(Threat threat, List swarmMates, FlightPhase flightPhase, List interceptors, double deltaTime); } /// /// Navigation strategy that this threat will use to move towards its target. /// public NavigationStrategy strategy; public override bool IsAssignable() { return false; } protected override void Start() { base.Start(); } protected override void FixedUpdate() { base.FixedUpdate(); // NOTE: no swarm-mates for now strategy.Execute(this, new List(), GetFlightPhase(), SimManager.Instance.GetActiveInterceptors(), Time.fixedDeltaTime); } /// /// OVERRIDE: THIS SHOULD NEVER BE CALLED; threats always start in midcourse or (at the very /// earliest) boost phase. /// /// /// protected override void UpdateReady(double deltaTime) { throw new System.NotImplementedException(); } }