Exemplo n.º 1
0
        private ActionsByLayer CreateActionsByLayer(List <ActionConfig> actionConfigs, DungeonLogic dungeonLogic)
        {
            ActionsByLayer actionsByLayer = new ActionsByLayer();

            foreach (ActionConfig actionConfig in actionConfigs)
            {
                if (actionConfig.IsDisabled())
                {
                    continue;
                }

                IAction action = CreateAction(actionConfig, dungeonLogic);
                actionsByLayer.allActions.Add(action);

                switch (action.GetLayer())
                {
                case DungeonSpawnConfig.ActionLayer.Stage:
                    actionsByLayer.stageActions.Add(action);
                    break;

                case DungeonSpawnConfig.ActionLayer.Dungeon:
                    actionsByLayer.dungeonActions.Add(action);
                    break;
                }
            }

            return(actionsByLayer);
        }
Exemplo n.º 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);
            }
        }