Пример #1
0
        private Challenge CreateChallenge(ChallengeConfig challengeConfig, List <IAction> actions, DungeonLogic dungeonLogic)
        {
            Trigger       startTrigger = CreateTrigger(challengeConfig.StartTrigger());
            SpawnOverTime sot          = CreateSpawnOverTime(challengeConfig.SpawnConfig());

            List <TrackerConfig> trackerConfigs = challengeConfig.SpawnConfig().TrackerConfigs();

            foreach (TrackerConfig trackerConfig in trackerConfigs)
            {
                if (!trackerConfig.IsActive())
                {
                    continue;
                }

                Tracker tracker = CreateTracker(trackerConfig);
                sot.AddTracker(tracker);
            }

            // List<ActionConfig> actionConfigs = challengeConfig.SpawnConfig().ActionConfigs();
            // foreach (ActionConfig actionConfig in actionConfigs)
            // {
            //  if (actionConfig.IsDisabled()) continue;
            //
            //  IAction action = CreateAction(actionConfig, dungeonLogic);
            //  sot.AddAction(action);
            // }

            foreach (IAction action in actions)
            {
                sot.AddAction(action);
            }

            DefaultChallenge challenge = new DefaultChallenge(startTrigger, sot);

            return(challenge);
        }
Пример #2
0
        private void CreateWaves(StageConfig stageConfig, DefaultStage stage, DungeonLogic dungeonLogic)
        {
            List <WaveConfig> waves = stageConfig.WaveList();

            for (int waveIndex = 0; waveIndex < waves.Count; waveIndex++)
            {
                WaveConfig w = waves[waveIndex];
                if (w.IsDisabled())
                {
                    continue;
                }

                DefaultWaveLogic       waveLogic        = new DefaultWaveLogic(waveIndex + 1);
                List <ChallengeConfig> challengeConfigs = w.ChallengeList();
                for (int challengeIndex = 0; challengeIndex < challengeConfigs.Count; challengeIndex++)
                {
                    ChallengeConfig challengeConfig = challengeConfigs[challengeIndex];
                    if (challengeConfig.IsDisabled())
                    {
                        continue;
                    }

                    ActionsByLayer actionsByLayer = CreateActionsByLayer(challengeConfig.SpawnConfig().ActionConfigs(), dungeonLogic);
                    Challenge      challenge      = CreateChallenge(challengeConfig, actionsByLayer.allActions, dungeonLogic);
//					challenge.Name = (waveIndex + 1) + "-" + (challengeIndex + 1);
                    waveLogic.AddChallenge(challenge);

                    foreach (IAction stageAction in actionsByLayer.stageActions)
                    {
                        stage.AddAction(stageAction);
                    }

                    foreach (IAction dungeonAction in actionsByLayer.dungeonActions)
                    {
                        dungeonLogic.AddAction(dungeonAction);
                    }
                }

                stage.AddWave(waveLogic);
            }
        }