コード例 #1
0
 public void StartWaves()
 {
     wave_starting   = true;
     spawning        = true;
     current_wave    = waves[0];
     timer           = 0.0f;
     current_subwave = 0;
 }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        if (spawning)
        {
            if (wave_starting)
            {
                InitialSpawn();
            }

            else
            {
                if (timer > current_wave.delay_time)
                {
                    SubWave();
                    timer = 0.0f;
                }
                else
                {
                    timer += Time.deltaTime;
                }
            }
        }

        else if (current_wave.units.Count <= 0)
        {
            int next_wave = waves.IndexOf(current_wave) + 1;
            if (next_wave < waves.Count)
            {
                current_wave    = waves[next_wave];
                spawning        = true;
                wave_starting   = true;
                current_subwave = 0;
            }
            else
            {
                game_manager.win = true;
            }
        }
    }