private void Check() { if (completed) { return; } var x = hbuilder.colonistsCount; conditionQuest.stepsAddInfo[0] = x.ToString().ToString() + " / " + COLONISTS_GOAL.ToString(); conditionQuest.stepsFinished[0] = x >= COLONISTS_GOAL; conditionQuest.stepsFinished[1] = (colony.energySurplus > 0f) & (colony.energyCrystalsCount > 0f); conditionQuest.stepsFinished[2] = hbuilder.completed; if (conditionQuest.stepsFinished[0] && conditionQuest.stepsFinished[1] && conditionQuest.stepsFinished[2]) { //end scenario completed = true; UIController.GetCurrent().updateEvent -= this.Check; colony.populationUpdateEvent -= this.CitizensUpdate; conditionQuest.MakeQuestCompleted(); scenarioUI.DisableConditionPanel(0); scenario.EndScenario(); } else { conditionWindow.Refresh(); } }
public override void EndScenario() { completed = true; GameMaster.SetPause(true); GameMaster.realMaster.UnbindScenario(this); if (scenarioUI != null) { scenarioUI.DisableConditionPanel(0); scenarioUI.DisableConditionPanel(1); scenarioUI.ScenarioEnds(this); } settleWindow = null; if (settleQuest != null) { settleQuest.MakeQuestCompleted(); settleQuest = null; UIController.GetCurrent().updateEvent -= CheckSettlingConditions; } scenarioQuest?.MakeQuestCompleted(); scenarioQuest = null; //hexBuilder. // FollowingCamera.main.SetObservingPosition( hexBuilder.GetHexWorldPosition(new HexPosition(3, Random.Range(0, 18))) + Vector3.up * 5f, GameMaster.sceneCenter + Vector3.down * 5f ); //UIController.GetCurrent().ChangeUIMode(UIMode.Endgame, true); GameMaster.realMaster.GameOver(GameEndingType.FoundationRoute); GameMaster.SetPause(false); // minus one pause request }