Пример #1
0
    private void Awake()
    {
        QualitySettings.vSyncCount  = 0;
        Application.targetFrameRate = 9999;

        m_camera.orthographicSize = 4 + ((float)m_waveSize - 10) * 0.4f;

        switch (m_type)
        {
        case WaveType.Classic:
            m_controller = new ClassicWave(transform, m_waveSize, m_waveSpeed);
            break;

        case WaveType.HybridECS:
            m_controller = new HybridECSWave(transform, m_waveSize, m_waveSpeed);
            break;

        case WaveType.ClassicJobSystem:
            m_controller = new ClassicJobSystemWave(transform, m_waveSize, m_waveSpeed);
            break;

        case WaveType.PureECS:
            m_controller = new PureECSWave(transform, m_waveSize, m_waveSpeed);
            break;
        }
    }
    protected void HandleWaveCreation()
    {
        if (!currentWave)
        {
            //If boss flag is true spawn a boss wave!
            if (Boss)
            {
                //Create a boss wave.
                currentWave = CreateBossWave();

                //Send the message for boss started
                GameObjectTracker.GetGOT().BossWaveStart();

                //Store the time off the current music so we can resume.
                //currentaudiotime = AudioPlayer.GetPlayer().audio.time;

                //Set and play the boss music.
                //AudioPlayer.GetPlayer().PlayAudioClip(BossSoundtrack);

                //Push the boss sound track.
                AudioPlayer.GetPlayer().PushTrack(BossSoundtrack);

                return;
            }

            currentWave = CreateWave();
        }

        if (currentWave.IsCompleted())
        {
            //If it was a boss wave do boss clean up stuff here.
            if (Boss)
            {
                //turn boss off.
                Boss = false;

                //Incriment the count of bosses destroyed.
                bossWaveCount++;

                //Send the message for boss being completed
                GameObjectTracker.GetGOT().BossWaveCompleted();

                //Return to our regular music programming.
                //AudioPlayer.GetPlayer().PlayAudioClip(PhaseSoundtrack,currentaudiotime);

                //Pop from the boss track.
                AudioPlayer.GetPlayer().PopTrack();
            }

            //print("Wave Completed!");
            Destroy(currentWave.gameObject);
            wavesDestroyedCount++;
            totalWavesDestroyed++;

            //Send the message for wave being completed
            GameObjectTracker.GetGOT().WaveCompleted();
        }
    }