public override void StartTask(TrafficAI_Base ai) { Debug.Log("Starting landing at airport task!"); Debug.Log("Trying to land on " + airport.id); TrafficAI_Transport transportAI = (TrafficAI_Transport)ai; transportAI.aircraft.RearmAt(airport); base.StartTask(ai); }
public override void StartTask(TrafficAI_Base ai) { Debug.Log("Starting air to air refueling!"); Debug.Log("Trying to refuel with " + refuelPlane.gameObject.name); TrafficAI_Transport transportAI = (TrafficAI_Transport)ai; transportAI.pilot.fuelTank.SetNormFuel(Mathf.Min(transportAI.pilot.fuelTank.fuel / transportAI.pilot.fuelTank.maxFuel, 0.5f)); transportAI.pilot.GoRefuel(refuelPlane); base.StartTask(ai); }
public override bool CanStartTask(TrafficAI_Base ai) { TrafficAI_CAP capAI = ai as TrafficAI_CAP; if (capAI == null) { return(false); } return(base.CanStartTask(ai)); }
public override void StartTask(TrafficAI_Base ai) { Debug.Log("Starting landing at temporary task!"); TrafficAI_Transport transportAI = (TrafficAI_Transport)ai; ai.waypoint.GetTransform().position = VTMapManager.GlobalToWorldPoint(point); transportAI.aircraft.LandAtWpt(ai.waypoint); idleTimer = UnityEngine.Random.Range(15f, 30f); base.StartTask(ai); }
public override void StartTask(TrafficAI_Base ai) { Debug.Log("Starting fly off map task!"); TrafficAI_Transport ai2 = (TrafficAI_Transport)ai; ai2.waypoint.GetTransform().position = VTMapManager.GlobalToWorldPoint(AirTraffic.PointOnMapRadius()); ai2.aircraft.SetOrbitNow(ai2.waypoint, 10000, AirTraffic.cruisingAltitudes.Random()); ai2.pilot.navSpeed = UnityEngine.Random.Range(ai2.normalSpeed, ai2.pilot.maxSpeed); base.StartTask(ai2); }
public override void StartTask(TrafficAI_Base ai) { Debug.Log("Starting scout airbase!"); TrafficAI_CAP capAI = (TrafficAI_CAP)ai; ai.waypoint.GetTransform().position = VTMapManager.GlobalToWorldPoint(point); capAI.Orbit(ai.waypoint, radius, alt); idleTimer = UnityEngine.Random.Range(30f, 120f); arived = false; base.StartTask(ai); }
public override bool CanStartTask(TrafficAI_Base ai) { if (base.CanStartTask(ai)) { TrafficAI_Transport transportAI = (TrafficAI_Transport)ai; return(transportAI.pilot.isVtol); } else { return(false); } }
public override bool IsTaskCompleted(TrafficAI_Base ai) { TrafficAI_CAP capAI = (TrafficAI_CAP)ai; foreach (TrafficAI_CAP.CAP_Aircraft plane in capAI.formation) { if (plane.pilot.commandState == AIPilot.CommandStates.AirRefuel) { return(false); } } return(true); }
public override void StartTask(TrafficAI_Base ai) { Debug.Log("Starting air to air refueling!"); TrafficAI_CAP capAI = (TrafficAI_CAP)ai; foreach (TrafficAI_CAP.CAP_Aircraft plane in capAI.formation) { plane.pilot.fuelTank.SetNormFuel(Mathf.Min(plane.pilot.fuelTank.fuel / plane.pilot.fuelTank.maxFuel, 0.5f)); plane.pilot.CommandCancelOverride(); plane.pilot.GoRefuel(refuelPlane); } base.StartTask(ai); }
public override bool CanStartTask(TrafficAI_Base ai) { TrafficAI_Transport transportAI = (TrafficAI_Transport)ai; if (base.CanStartTask(ai)) { return(refuelPlane != null && transportAI.pilot.refuelPort); } else { return(false); } }
public override void UpdateTask(TrafficAI_Base ai, float deltaTime) { TrafficAI_Transport transportAI = (TrafficAI_Transport)ai; if (transportAI.pilot.commandState == AIPilot.CommandStates.Park) { idleTimer -= deltaTime; if (idleTimer < 0) { transportAI.aircraft.TakeOff(); } } }
public override bool CanStartTask(TrafficAI_Base ai) { if (base.CanStartTask(ai)) { if (ai.gameObject.name == "ABomberAI") { return(false); } TrafficAI_Transport transportAI = (TrafficAI_Transport)ai; return(transportAI.pilot.parkingSize < maxSize && (transportAI.rb.mass < maxMass || (vtolOnly && transportAI.pilot.isVtol)) && ParkingAvailable(transportAI.pilot.parkingSize)); } else { return(false); } }
public override void UpdateTask(TrafficAI_Base ai, float deltaTime) { TrafficAI_CAP capAI = (TrafficAI_CAP)ai; Vector3 flatPos = capAI.formation[0].transform.position; flatPos.y = 0; Vector3 flatWaypoint = ai.waypoint.GetTransform().position; flatPos.y = 0; if ((flatPos - flatWaypoint).magnitude < radius * 1.2f) { arived = true; } if (arived) { idleTimer -= Time.fixedDeltaTime; } }
public virtual bool CanStartTask(TrafficAI_Base ai) { return(aircraftDoingTask.Count() < maxPerTask); }
public override bool IsTaskCompleted(TrafficAI_Base ai) { TrafficAI_Transport transportAI = (TrafficAI_Transport)ai; return(transportAI.pilot.commandState == AIPilot.CommandStates.Orbit); }
public virtual void StartTask(TrafficAI_Base ai) { aircraftDoingTask.Add(ai); Debug.Log("Task started, there are now " + aircraftDoingTask.Count + " doing task: " + taskName); }
public virtual void UpdateTask(TrafficAI_Base ai, float deltaTime) { }
public virtual void EndTask(TrafficAI_Base ai) { aircraftDoingTask.Remove(ai); Debug.Log("Task completed, there are now " + aircraftDoingTask.Count + " doing task: " + taskName); }
public override bool IsTaskCompleted(TrafficAI_Base ai) { return(idleTimer < 0); }
public virtual bool IsTaskCompleted(TrafficAI_Base ai) { return(true); }
public override bool IsTaskCompleted(TrafficAI_Base ai) { return(false); }