예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (debug || !hero.IsAlive() || waitForPlayer)
        {
            return;
        }

        if (!endLevel || enemySpawner.transform.childCount == 0)
        {
            timerDuration += Time.deltaTime;
        }
        if (timerDuration >= infos[level].duration && !endLevel)
        {
            endLevel = true;
            enemySpawner.Pause();
        }
        if (endLevel && timerDuration > infos[level].duration + 2.0f && enemySpawner.transform.childCount == 0)
        {
            waitForPlayer = true;
            bgGeneration.Pause();
            if (infos[level].boss != null)
            {
                GameObject obj  = GameObject.Instantiate(infos[level].boss);
                ABoss      boss = obj.GetComponent <ABoss>();
                boss.Init(hero, 1.0f);
                boss.RemoveColor();
            }
            else
            {
                hero.EndLevel();
            }
        }
    }