public void StartNewRound() { this.curPhase = this.phaseNodes[PhaseNode.PhaseID.StartRound]; this.curPhaseEnumerator = this.curPhase.PerformPhase(this); this.mainGameLoop = this.Resume(); this.ContinueMainGameLoop(); }
private void SwitchPhase(PhaseNode nextNode) { currentPhase.OnEnd(); currentPhase = nextNode; boss.health = currentPhase.health; boss.currentHealth = currentPhase.health; boss.healthManager.Init(currentPhase.health); currentPhase.OnBegin(); }
public IEnumerator Resume() { while (this.curPhase != null) { bool phaseStillProc = this.curPhaseEnumerator.MoveNext(); // Let frontend process all game requests. if (this.CheckIfShouldYield()) { yield return(0); } // Process all decisions. { IEnumerator decisionProcEnumerator = this.ProcessQueuedDecisions(); bool hasNext = true; do { hasNext = decisionProcEnumerator.MoveNext(); yield return(0); } while (hasNext); } { IEnumerator commandProcEnumerator = this.ProcessQueuedCommands(); bool hasNext = true; do { hasNext = commandProcEnumerator.MoveNext(); yield return(0); } while (hasNext); } // Let frontend process all game requests. if (this.CheckIfShouldYield()) { yield return(0); } if (!phaseStillProc) { if (this.nextPhaseToForce != null) { this.curPhase = this.nextPhaseToForce; this.nextPhaseToForce = null; } else { this.curPhase = this.curPhase.Next; } if (curPhase != null) { this.curPhaseEnumerator = this.curPhase.PerformPhase(this); } this.EnqueueUIUpdateRequest(new UIUpdateRequest(UIUpdateRequest.UpdateType.UpdateBoard)); yield return(0); } } this.Reset(); yield break; }
public void ForcePhaseAsNext(PhaseNode.PhaseID phaseId) { this.nextPhaseToForce = this.phaseNodes[phaseId]; }