public void StartUp() { //DLog.Log("Dungeon start up"); foreach (Component component in components) { component.StartUp(); } CheckStagesIsConfigProperly(); activeStage = stages[0]; activeStageComponent = new StageComponent(activeStage); AddComponent(activeStageComponent); CheckStageCountMatchGateCount(); if (gates.Count > 0) { activeGateController = gates[0]; } CheckStageCountMatchStageActivatorCount(); if (stageActivators.Count > 0) { activeStageActivator = stageActivators[0]; } activeStage.OnStart(); activeStage.ListenToWaveCycle(OnWaveCycle); DungeonActionComponent actionComponent = new DungeonActionComponent(actions); AddComponent(actionComponent); }
private void MoveToNextStage() { activeStage.UnlistenToWaveCycle(OnWaveCycle); int indexOfActiveStage = stages.IndexOf(activeStage); NotifyStageCycle(indexOfActiveStage + 1, StageCycle.End); activeStage = stages[indexOfActiveStage + 1]; activeStage.OnStart(); activeStage.ListenToWaveCycle(OnWaveCycle); components.Remove(activeStageComponent); activeStageComponent = new StageComponent(activeStage); activeStageComponent.StartUp(); activeStageComponent.Start(); AddComponent(activeStageComponent); currentStageOrder = indexOfActiveStage + 2; NotifyStageCycle(currentStageOrder, StageCycle.Start); //DLog.Log("NEXT STAGE"); }