Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
    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();
    }
Ejemplo n.º 3
0
 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!");
     }
 }
Ejemplo n.º 4
0
    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();
                }
            }
        }
    }
Ejemplo n.º 5
0
    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);
             * }*/
        }
    }
Ejemplo n.º 6
0
 public static void CallNextSubPhase()
 {
     CurrentSubPhase.CallNextSubPhase();
 }
Ejemplo n.º 7
0
 public static void Next()
 {
     //Debug.Log("NEXT - finish for: " + CurrentSubPhase);
     CurrentSubPhase.Next();
 }
Ejemplo n.º 8
0
    // TEMPORARY SUBPHASES

    public static void StartTemporarySubPhaseOld(string name, System.Type subPhaseType, Action callBack = null)
    {
        GenericSubPhase subphase = StartTemporarySubPhaseNew(name, subPhaseType, callBack);

        CurrentSubPhase.Start();
    }