Exemple #1
0
 /// <summary>
 /// Returns <c>true</c> and provides valid <c>stationSelectionCriteria</c> if the current FormationStation doesn't meet the needs
 /// implied by the provided <c>purpose</c>, <c>false</c> if the current station already meets those needs. If valid, the
 /// stationSelectionCritera will allow Command to determine whether a FormationStation is available that meets those needs.
 /// </summary>
 /// <param name="purpose">The purpose of the station change.</param>
 /// <param name="stationSelectionCriteria">The resulting station selection criteria needed by Cmd to determine station availability.</param>
 /// <returns></returns>
 private bool TryDetermineNeedForFormationStationChange(WithdrawPurpose purpose, out AFormationManager.FormationStationSelectionCriteria stationSelectionCriteria) {
     if (IsThereNeedForAFormationStationChangeTo(purpose)) {
         stationSelectionCriteria = new AFormationManager.FormationStationSelectionCriteria() { IsReserveReqd = true };
         return true;
     }
     stationSelectionCriteria = default(AFormationManager.FormationStationSelectionCriteria);
     return false;
 }
Exemple #2
0
 private bool RequestFormationStationChange(ShipItem ship, AFormationManager.FormationStationSelectionCriteria stationSelectionCriteria, ref int iterateCount) {
     if (FormationMgr.IsSlotAvailable(stationSelectionCriteria)) {
         //D.Log(ShowDebugLog, "{0} request for formation station change has been approved.", ship.DebugName);
         FormationMgr.AddAndPositionNonHQElement(ship, stationSelectionCriteria);
         return true;
     }
     iterateCount++;
     return false;
 }
Exemple #3
0
 protected override void InitializeOnAwake() {
     base.InitializeOnAwake();
     Elements = new List<AUnitElementItem>();
     SensorRangeMonitors = new List<ISensorRangeMonitor>();
     FormationMgr = InitializeFormationMgr();
 }
Exemple #4
0
 /// <summary>
 /// Requests a change in the ship's formation station assignment based on the stationSelectionCriteria provided.
 /// Returns <c>true</c> if the ship's formation station assignment was changed, <c>false</c> otherwise.
 /// </summary>
 /// <param name="ship">The ship.</param>
 /// <param name="stationSelectionCriteria">The station selection criteria.</param>
 /// <returns></returns>
 public bool RequestFormationStationChange(ShipItem ship, AFormationManager.FormationStationSelectionCriteria stationSelectionCriteria) {
     int iterateCount = Constants.Zero;
     while (iterateCount < 3) {
         if (RequestFormationStationChange(ship, stationSelectionCriteria, ref iterateCount)) {
             return true;
         }
         // TODO modify stationSelectionCriteria here to search for criteria that fits an available slot
     }
     return false;
 }