public void Init(string starterName, GamePhase before, GamePhase after) { PhaseName = starterName; name = starterName + " Phase"; PreviousPhase = before; NextPhase = after; }
public void ForceAdvancePhase(bool EndFirst) { Debug.Log("Force advance phase from [" + name + "]\n"); if (Starting != null) { StopCoroutine(Starting); } //We want to mark to begin next phase on end completion. //Unintended consequence to consider later - We're setting that value to true and we might want it false later. //Should it always get set when called? if (EndFirst) { if (Ending == null) { //Set us to a reasonable phase. PhaseState = PhaseEnum.Running; CurrentPhase = this; //Start the end StartCoroutine(EndPhase()); } //Otherwise do nothing } else { if (Ending != null) { StopCoroutine(Starting); } } }
IEnumerator StartPhase() { StartingCorout = true; if (PhaseState == PhaseEnum.Unstarted) { PhaseState = PhaseEnum.Starting; yield return(OnPhaseStart()); yield return(new WaitForSeconds(StartDuration)); PhaseState = PhaseEnum.Running; CurrentPhase = this; } StartingCorout = false; }