示例#1
0
 private void Setup()
 {
     //Debug.Log("Setup() called");
     _index++;
     if (_index >= waves.Count)
     {
         bool allDead = true;
         foreach (Wave w in waves)
         {
             allDead = allDead && w.AllDead;
         }
         if (allDead)
         {
             state = WavesState.Finished;
         }
         return;
     }
     else
     {
         Wave current = waves[_index];
         current.initUnits();
         current.started = true;
         if (_index + 1 == waves.Count)
         {
             current.last = true;
         }
         state = WavesState.Idle;
     }
 }
示例#2
0
    IEnumerator Start()
    {
        state = WavesState.Initialize;
        while (true)
        {
            switch (state)
            {
            case WavesState.Initialize:
                Initialize();
                break;

            case WavesState.NotStarted:
                break;

            case WavesState.Setup:
                Setup();
                break;

            case WavesState.Idle:
                Wait();
                break;

            case WavesState.Finished:
                Finish();
                break;

            default:
                break;
            }
            yield return(0);
        }
    }
示例#3
0
 private void Initialize()
 {
     //Debug.Log("Initialize() called");
     _index             = -1;
     _autoStartNextWave = true;
     //Begin();
     state = WavesState.NotStarted;
 }
示例#4
0
 private void Wait()
 {
     if (!waves[_index].last)
     {
         GUIManager.instance.UpdateWaveCounter(_index + 1, WavesCount);
     }
     else
     {
         GUIManager.instance.UpdateWaveCounter(_index + 1, WavesCount, true);
     }
     if (waves[_index].Done)
     {
         state = WavesState.Setup;
     }
 }