// Use this for initialization
 void Start()
 {
     this.money = GameObject.FindObjectOfType <MoneyManager>();
     //Set up Next Wave button text
     WaveTime           = 5;
     NextButtonTxt      = GameObject.Find("NextWaveBtn").GetComponentInChildren <Button>().GetComponentInChildren <Text>();
     NextButtonTxt.text = "Next Wave: " + WaveTime.ToString("F0");
     LoadWaveData();
     //Update remaining time every second
     InvokeRepeating("UpdateTime", 0f, 1f);
     InvokeRepeating("MoveProgressBar", 5f, 0.05f);
 }
    // Update is called once per frame
    void Update()
    {
        if (paused)
        {
            return;
        }
        timePassed += Time.deltaTime;

        WaveTime -= Time.deltaTime;
        //Reset wave time and spawn next wave at the end of the wave time
        if (WaveTime < 0)
        {
            WaveTime       = Countdown;
            RemainingUnits = 1.83m;
            StartWave();
        }
        else if (WaveTime < 1 && WaveData.Count < 1)
        {
            Victory();
        }
        //Update Next Wave button text
        NextButtonTxt.text = "Next Wave: " + WaveTime.ToString("F0");
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Добавить волну в уровень
 /// </summary>
 public void AddWave(MonsterWave wave, double period = 10.0)
 {
     Waves.Add(wave);
     WaveTime.Add(period);
 }