Exemplo n.º 1
0
 public void PauseOn()
 {
     Instantiate(Pause, transform.position, transform.rotation);
     pause = true;
     foreach (GameObject objs in Turrets)
     {
         objs.SetActive(false);
     }
     foreach (GameObject Enem in enemies)
     {
         Enem.SetActive(false);
     }
     foreach (GameObject bArs in Bars)
     {
         bArs.SetActive(false);
     }
     foreach (GameObject bOmb in Bombs)
     {
         bOmb.SetActive(false);
     }
     foreach (GameObject ProJ in Projectiles)
     {
         ProJ.SetActive(false);
     }
     foreach (GameObject fIre in FireShots)
     {
         fIre.SetActive(false);
     }
     foreach (GameObject iCes in Ices)
     {
         iCes.SetActive(false);
     }
 }
Exemplo n.º 2
0
    public void PauseOfF()
    {
        round_accessor.pause = false;
        foreach (GameObject objs in round_accessor.Turrets)
        {
            objs.SetActive(true);
        }
        foreach (GameObject Enem in round_accessor.enemies)
        {
            Enem.SetActive(true);
        }
        foreach (GameObject bArs in round_accessor.Bars)
        {
            bArs.SetActive(true);
        }
        foreach (GameObject bOmb in round_accessor.Bombs)
        {
            bOmb.SetActive(true);
        }
        foreach (GameObject ProJ in round_accessor.Projectiles)
        {
            ProJ.SetActive(true);
        }
        foreach (GameObject fIre in round_accessor.FireShots)
        {
            fIre.SetActive(true);
        }
        foreach (GameObject iCes in round_accessor.Ices)
        {
            iCes.SetActive(true);
        }
        GameObject PauseScreen = GameObject.Find("Pause Screen(Clone)");

        Destroy(PauseScreen);
    }
Exemplo n.º 3
0
        // Update is called once per frame
        void Update()
        {
            if (startTimer > 0 && currentEnemies == maxEnemies && enemies.Length == 0) //if we're either counting down or still waiting
            {
                roundIsOver = true;                                                    //round is still in over state
            }
            else                                                                       //otherwise
            //the round is over and we need to
            //start the next wave
            {
                roundIsOver = false;
            }

            if (roundIsOver == true)                                                                                //if the round is in over state
            {
                if (Input.GetKeyDown("space"))                                                                      //"press space to start the countdown timer
                {
                    if (startTimer > 0)                                                                             // but only if its not 0
                    {
                        InvokeRepeating("CountDown", 1, 1);
                    }
                }

                //current_enemy_amount = enemies.Length;
            }

            round                = "<color=#ff0000ff><size=30>Round: " + wave + "</size></color>";
            RoundHeight          = (Screen.height - (Screen.height - 75));
            current_enemy_amount = enemies.Length;



            if (Input.GetKeyDown("escape") && pause == false)
            {
                Instantiate(Pause, transform.position, transform.rotation);
                pause = true;
                foreach (GameObject objs in Turrets)
                {
                    objs.SetActive(false);
                }
                foreach (GameObject Enem in enemies)
                {
                    Enem.SetActive(false);
                }
                foreach (GameObject bArs in Bars)
                {
                    bArs.SetActive(false);
                }
                foreach (GameObject bOmb in Bombs)
                {
                    bOmb.SetActive(false);
                }
                foreach (GameObject ProJ in Projectiles)
                {
                    ProJ.SetActive(false);
                }
                foreach (GameObject fIre in FireShots)
                {
                    fIre.SetActive(false);
                }
                foreach (GameObject iCes in Ices)
                {
                    iCes.SetActive(false);
                }
            }
            else if (Input.GetKeyDown("escape") && pause == true)
            {
                pause = false;
                foreach (GameObject objs in Turrets)
                {
                    objs.SetActive(true);
                }
                foreach (GameObject Enem in enemies)
                {
                    Enem.SetActive(true);
                }
                foreach (GameObject bArs in Bars)
                {
                    bArs.SetActive(true);
                }
                foreach (GameObject bOmb in Bombs)
                {
                    bOmb.SetActive(true);
                }
                foreach (GameObject ProJ in Projectiles)
                {
                    ProJ.SetActive(true);
                }
                foreach (GameObject fIre in FireShots)
                {
                    fIre.SetActive(true);
                }
                foreach (GameObject iCes in Ices)
                {
                    iCes.SetActive(true);
                }
                GameObject PauseScreen = GameObject.Find("Pause Screen(Clone)");
                Destroy(PauseScreen);
            }
            if (pause == false)
            {
                enemies     = GameObject.FindGameObjectsWithTag("Enemy");
                Turrets     = GameObject.FindGameObjectsWithTag("Turret");
                Bars        = GameObject.FindGameObjectsWithTag("Bar");
                FireShots   = GameObject.FindGameObjectsWithTag("Fire");
                Projectiles = GameObject.FindGameObjectsWithTag("Projectile");
                Ices        = GameObject.FindGameObjectsWithTag("Ice");
                Bombs       = GameObject.FindGameObjectsWithTag("Bomb");
            }

            pauseY = (Screen.height / 2 - 100);
            pauseX = (Screen.width / 2 - 200);


            if (lives <= 0)
            {
                Application.LoadLevel("Forest");
            }
            if (SpeedTog.isOn == true)
            {
                Time.timeScale = 2f;
            }
            else if (SpeedTog.isOn == false)
            {
                Time.timeScale = 1f;
            }
        }