Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if(canvasTutorial.activeSelf){

            behave.pause = true;

        }

        //logica do tutorial

        //SE O GAMEPLAY TIVER TEMPO

        //		if (behave.showTutorial && startTime) {
        //			time += Time.deltaTime;
        //
        //			if(time >= 25){
        //				print ("ACABOU GAMEPLAY DO TUTORIAL");
        //				startTime = !startTime;
        //			}
        //
        //		}

        //		if (behave.selectedWeapon == 0)
        //			infinity.SetActive (true);
        //		else
        //			infinity.SetActive (false);

        bool alive = false;
        //checks if all enemies are dead
        count = enemiesInScene.Count;
        foreach(GameObject enemy in enemiesInScene){

            if(!enemy.GetComponent<Enemy>().dead){

                alive = true;
                count--;

            }

        }
        countingText.GetComponent<Text>().text = "" + count;
        totalText.GetComponent<Text>().text = "" + enemiesInScene.Count;

        //checks if alive

        if(!alive && timer > 9 )
        {
            timer = 8;
            clearedText.GetComponent<Text>().text = "cleared";
            clearedText.GetComponent<TranslateText>().Refresh();

            clearedText.GetComponent<Animator>().SetTrigger("cleared");
        }

        if(!alive)
        {
            if(timer > 2 && timer < 4){
                if(go){
                    behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();
                    behave.CheckHordeAchievements((level - 1));
                    clearedText.GetComponent<Text>().text = "Horde " + level;
                    clearedText.GetComponent<Animator>().SetTrigger("cleared");
                    go = false;
                }

            }

            timer = timer - Time.deltaTime;
            if(timer <= 0)
            {

                Respawn();

            }

        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        if (canvasTutorial.activeSelf)
        {
            behave.pause = true;
        }

        //logica do tutorial

        //SE O GAMEPLAY TIVER TEMPO


//		if (behave.showTutorial && startTime) {
//			time += Time.deltaTime;
//
//			if(time >= 25){
//				print ("ACABOU GAMEPLAY DO TUTORIAL");
//				startTime = !startTime;
//			}
//
//		}

//		if (behave.selectedWeapon == 0)
//			infinity.SetActive (true);
//		else
//			infinity.SetActive (false);


        bool alive = false;

        //checks if all enemies are dead
        count = enemiesInScene.Count;
        foreach (GameObject enemy in enemiesInScene)
        {
            if (!enemy.GetComponent <Enemy>().dead)
            {
                alive = true;
                count--;
            }
        }
        countingText.GetComponent <Text>().text = "" + count;
        totalText.GetComponent <Text>().text    = "" + enemiesInScene.Count;

        //checks if alive

        if (!alive && timer > 9)
        {
            timer = 8;
            clearedText.GetComponent <Text>().text = "cleared";
            clearedText.GetComponent <TranslateText>().Refresh();


            clearedText.GetComponent <Animator>().SetTrigger("cleared");
        }

        if (!alive)
        {
            if (timer > 2 && timer < 4)
            {
                if (go)
                {
                    behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent <GameBehavior>();
                    behave.CheckHordeAchievements((level - 1));
                    clearedText.GetComponent <Text>().text = "Horde " + level;
                    clearedText.GetComponent <Animator>().SetTrigger("cleared");
                    go = false;
                }
            }


            timer = timer - Time.deltaTime;
            if (timer <= 0)
            {
                Respawn();
            }
        }
    }