public static GenericSubPhase StartTemporarySubPhaseNew(string name, System.Type subPhaseType, Action callBack) { if (CurrentSubPhase != null) { CurrentSubPhase.Pause(); } if (DebugManager.DebugPhases) { Debug.Log("Temporary phase " + subPhaseType + " is started directly"); } GenericSubPhase previousSubPhase = CurrentSubPhase; CurrentSubPhase = (GenericSubPhase)System.Activator.CreateInstance(subPhaseType); CurrentSubPhase.Name = name; CurrentSubPhase.CallBack = callBack; CurrentSubPhase.PreviousSubPhase = previousSubPhase; if (previousSubPhase != null) { CurrentSubPhase.RequiredPlayer = previousSubPhase.RequiredPlayer; CurrentSubPhase.RequiredPilotSkill = previousSubPhase.RequiredPilotSkill; } return(CurrentSubPhase); }
public static void GoBack(Type specificSubphaseToFinish = null) { DecisionSubPhase decisionSubphase = CurrentSubPhase.PreviousSubPhase as DecisionSubPhase; if (decisionSubphase != null) { decisionSubphase.DecisionWasPreparedAndShown = false; } Type subphaseToFinish = specificSubphaseToFinish ?? CurrentSubPhase.GetType(); FinishSubPhase(subphaseToFinish); CurrentSubPhase.Resume(); }
public static void FinishSubPhase(System.Type subPhaseType) { if (CurrentSubPhase.GetType() == subPhaseType) { if (DebugManager.DebugPhases) { Debug.Log("Phase " + subPhaseType + "is finished directly"); } Next(); } else { Debug.Log("OOPS! YOU WANT TO FINISH " + subPhaseType + " SUBPHASE, BUT NOW IS " + CurrentSubPhase.GetType() + " SUBPHASE!"); } }
private static void CheckScheduledFinishes() { if (subPhasesToFinish.Count != 0) { List <System.Type> tempList = new List <System.Type>(); foreach (var subPhaseType in subPhasesToFinish) { tempList.Add(subPhaseType); } foreach (var subPhaseType in tempList) { if (CurrentSubPhase.GetType() == subPhaseType) { subPhasesToFinish.Remove(subPhaseType); Next(); } } } }
public static void FinishSubPhase(System.Type subPhaseType) { if (CurrentSubPhase.GetType() == subPhaseType) { if (DebugManager.DebugPhases) { Debug.Log("Phase " + subPhaseType + "is finished directly"); } Next(); } else { Debug.Log("OOPS! YOU WANT TO FINISH " + subPhaseType + " SUBPHASE, BUT NOW IS " + CurrentSubPhase.GetType() + " SUBPHASE!"); /*if (!subPhasesToFinish.Contains(subPhaseType)) * { * Debug.Log("Phase " + subPhaseType + " is planned to finish"); * subPhasesToFinish.Add(subPhaseType); * }*/ } }
public static void CallNextSubPhase() { CurrentSubPhase.CallNextSubPhase(); }
public static void Next() { //Debug.Log("NEXT - finish for: " + CurrentSubPhase); CurrentSubPhase.Next(); }
// TEMPORARY SUBPHASES public static void StartTemporarySubPhaseOld(string name, System.Type subPhaseType, Action callBack = null) { GenericSubPhase subphase = StartTemporarySubPhaseNew(name, subPhaseType, callBack); CurrentSubPhase.Start(); }