Example #1
0
        /// <summary>
        /// Starts the waves
        /// </summary>
        public virtual void StartWaves()
        {
            GameModel.MapCfg mapCfg            = ConfigService.Instance.MapCfgList.GetOne(GameData.gameInfo.currentLevels);
            int[]            createMonsterInfo = mapCfg.CreateMonster;
            int count = createMonsterInfo.Length;

            for (int i = 0; i < count; i++)
            {
                GameObject waveObj = new GameObject();
                waveObj.transform.parent = transform;
                waveObj.name             = "Wave" + i;
                TimedWave timedWave = waveObj.AddComponent <TimedWave>();

                WaveCfg waveCfg = ConfigService.Instance.WaveCfgList.GetOne(createMonsterInfo[i]);
                timedWave.timeToNextWave    = waveCfg.timeToNextWave;
                timedWave.spawnInstructions = new List <SpawnInstructionInfo>();
                for (int j = 0; j < waveCfg.monsterInfo.Length; j++)
                {
                    SpawnCfg             spawnCfg             = ConfigService.Instance.SpawnCfgList.GetOne(waveCfg.monsterInfo[j]);
                    SpawnInstructionInfo spawnInstructionInfo = new SpawnInstructionInfo();
                    spawnInstructionInfo.agentId      = spawnCfg.agentId;
                    spawnInstructionInfo.delayToSpawn = spawnCfg.delayToSpawn;
                    spawnInstructionInfo.startingNode = spawnCfg.startingNode;

                    timedWave.spawnInstructions.Add(spawnInstructionInfo);
                }

                waves.Add(timedWave);
            }


            if (waves.Count > 0)
            {
                InitCurrentWave();
            }
            else
            {
                Debug.LogWarning("[LEVEL] No Waves on wave manager. Calling spawningCompleted");
                SafelyCallSpawningCompleted();
            }
        }
Example #2
0
    /// <summary>
    /// This method starts a new wave, updating all the values to increase difficulty through waves
    /// </summary>
    private void StartWave()
    {
        m_TimeBetweenWavesAcum = 0.0f;
        BuilderManager.Singleton.SetBuildingTurn(false);

        ++m_WaveCount;

        m_WaveHUDController.UpdateHUD(m_WaveCount);

        int newNumEnemies = (int)(m_CurrentWave.m_NumEnemies + m_WaveCount * m_WaveContribuition);

        float newSpawnTime = Mathf.Max(0.8f ,m_CurrentWave.m_SpawnTime - m_WaveCount * m_WaveContribuition * 0.08f);

        m_EnemiesHUDController.UpdateHUD(newNumEnemies.ToString(), newNumEnemies.ToString());

        WaveCfg newWave = new WaveCfg(newNumEnemies, newSpawnTime);

        m_CurrentWave = newWave;

        m_inWave = true;
    }
Example #3
0
    /// <summary>
    /// Initialization of the first wave
    /// </summary>
    private void Start()
    {
        m_InitWaveCfg.m_NumEnemiesKilled = m_InitWaveCfg.m_NumEnemies;
        m_CurrentWave = m_InitWaveCfg;
        m_inWave = true;

        InputManager.Singleton.RegisterOrderEvent(onOrderReceived);
    }