Beispiel #1
0
    public void GotoLab()
    {
        Aguia.GetComponent <AguiaBehaviour>().AguiaPrefab.SetActive(true);
        Mamute.GetComponent <MamuteBehaviour>().MamutePrefab.SetActive(true);
        Peixe.GetComponent <PeixeBehaviour>().peixePrefab.SetActive(true);

        Peixe.GetComponent <PeixeBehaviour>().UI.SetActive(true);
        Aguia.GetComponent <AguiaBehaviour>().UI.SetActive(true);
        Mamute.GetComponent <MamuteBehaviour>().UI.SetActive(true);

        //Desativar UIS
        Aguia.GetComponent <AguiaBehaviour>().HabAtk.SetActive(true);
        Aguia.GetComponent <AguiaBehaviour>().HabDef.SetActive(true);

        Mamute.GetComponent <MamuteBehaviour>().HabAtk.SetActive(true);
        Mamute.GetComponent <MamuteBehaviour>().HabDef.SetActive(true);

        Peixe.GetComponent <PeixeBehaviour>().HabAtk.SetActive(true);
        Peixe.GetComponent <PeixeBehaviour>().HabDef.SetActive(true);

        Peixe.GetComponent <PeixeBehaviour>().load   = false;
        Aguia.GetComponent <AguiaBehaviour>().load   = false;
        Mamute.GetComponent <MamuteBehaviour>().load = false;

        Application.LoadLevel("LABORATORIO");
    }
Beispiel #2
0
    void Att()
    {
        name_text.text = ultimo_Monstro_Escolhido;

        wind.SetActive(true);
        fire.SetActive(true);
        water.SetActive(true);
        earth.SetActive(true);

        if (ultimo_Monstro_Escolhido == "Aguia")
        {
            vida_text.text        = ("" + Aguia.GetComponent <AguiaBehaviour>().vida);
            dano_text.text        = ("" + Aguia.GetComponent <AguiaBehaviour>().dano);
            resistencia_text.text = ("" + Aguia.GetComponent <AguiaBehaviour>().resistencia);
            sorte_text.text       = ("" + Aguia.GetComponent <AguiaBehaviour>().sorte);
            wind.SetActive(false);
            barraVidaController.UpdateBar(Aguia.GetComponent <AguiaBehaviour>().vida,
                                          Aguia.GetComponent <AguiaBehaviour>().dano,
                                          Aguia.GetComponent <AguiaBehaviour>().resistencia,
                                          Aguia.GetComponent <AguiaBehaviour>().sorte);
        }
        else if (ultimo_Monstro_Escolhido == "Mamute")
        {
            vida_text.text        = ("" + Mamute.GetComponent <MamuteBehaviour>().vida);
            dano_text.text        = ("" + Mamute.GetComponent <MamuteBehaviour>().dano);
            resistencia_text.text = ("" + Mamute.GetComponent <MamuteBehaviour>().resistencia);
            sorte_text.text       = ("" + Mamute.GetComponent <MamuteBehaviour>().sorte);
            earth.SetActive(false);
            barraVidaController.UpdateBar(Mamute.GetComponent <MamuteBehaviour>().vida,
                                          Mamute.GetComponent <MamuteBehaviour>().dano,
                                          Mamute.GetComponent <MamuteBehaviour>().resistencia,
                                          Mamute.GetComponent <MamuteBehaviour>().sorte);
        }
        else if (ultimo_Monstro_Escolhido == "Peixe")
        {
            vida_text.text        = ("" + Peixe.GetComponent <PeixeBehaviour>().vida);
            dano_text.text        = ("" + Peixe.GetComponent <PeixeBehaviour>().dano);
            resistencia_text.text = ("" + Peixe.GetComponent <PeixeBehaviour>().resistencia);
            sorte_text.text       = ("" + Peixe.GetComponent <PeixeBehaviour>().sorte);
            water.SetActive(false);
            barraVidaController.UpdateBar(Peixe.GetComponent <PeixeBehaviour>().vida,
                                          Peixe.GetComponent <PeixeBehaviour>().dano,
                                          Peixe.GetComponent <PeixeBehaviour>().resistencia,
                                          Peixe.GetComponent <PeixeBehaviour>().sorte);
        }
    }
    public void DanoDef()
    {
        if (enemyRoundDone == false)
        {
            if (GetComponent <BattleController>().monstroAtivo == "Aguia")
            {
                if (GetComponent <BattleController>().penaltyDef == 0)
                {
                    /*  dano = Enemy.GetComponent<UIEnemy>().forca - Enemy.GetComponent<UIEnemy>().sorte +
                     * Aguia.GetComponent<AguiaBehaviour>().resistencia;*/
                    dano = 100;
                    Aguia.GetComponent <AguiaBehaviour>().battleLife = Aguia.GetComponent <AguiaBehaviour>().battleLife - dano;
                }
                else if (GetComponent <BattleController>().penaltyDef > 0)
                {
                    /*  dano = (Enemy.GetComponent<UIEnemy>().forca / GetComponent<BattleController>().penaltyDef) -
                     *    (Enemy.GetComponent<UIEnemy>().sorte / GetComponent<BattleController>().penaltyDef) +
                     *    (Aguia.GetComponent<AguiaBehaviour>().resistencia / GetComponent<BattleController>().penaltyDef);*/
                    dano = 100;
                    Aguia.GetComponent <AguiaBehaviour>().battleLife = Aguia.GetComponent <AguiaBehaviour>().battleLife - dano;
                }
            }
            else if (GetComponent <BattleController>().monstroAtivo == "Peixe")
            {
                if (GetComponent <BattleController>().penaltyDef == 0)
                {
                    /* dano = Enemy.GetComponent<UIEnemy>().forca - Enemy.GetComponent<UIEnemy>().sorte +
                     *   Peixe.GetComponent<PeixeBehaviour>().resistencia;*/
                    dano = 100;
                    Peixe.GetComponent <PeixeBehaviour>().battleLife = Peixe.GetComponent <PeixeBehaviour>().battleLife - dano;
                }
                else if (GetComponent <BattleController>().penaltyDef > 0)
                {
                    /*  dano = (Enemy.GetComponent<UIEnemy>().forca / GetComponent<BattleController>().penaltyDef) -
                     *    (Enemy.GetComponent<UIEnemy>().sorte / GetComponent<BattleController>().penaltyDef) +
                     *        (Peixe.GetComponent<PeixeBehaviour>().resistencia / GetComponent<BattleController>().penaltyDef);*/
                    dano = 100;
                    Peixe.GetComponent <PeixeBehaviour>().battleLife = Peixe.GetComponent <PeixeBehaviour>().battleLife - dano;
                }
            }
            else if (GetComponent <BattleController>().monstroAtivo == "Mamute")
            {
                if (GetComponent <BattleController>().penaltyDef == 0)
                {
                    /*dano = Enemy.GetComponent<UIEnemy>().forca - Enemy.GetComponent<UIEnemy>().sorte +
                     *  Mamute.GetComponent<MamuteBehaviour>().resistencia;*/
                    dano = 100;
                    Mamute.GetComponent <MamuteBehaviour>().battleLife = Mamute.GetComponent <MamuteBehaviour>().battleLife - dano;
                }
                else if (GetComponent <BattleController>().penaltyDef > 0)
                {
                    /*dano = (Enemy.GetComponent<UIEnemy>().forca / GetComponent<BattleController>().penaltyDef) -
                     *  (Enemy.GetComponent<UIEnemy>().sorte / GetComponent<BattleController>().penaltyDef) +
                     *      (Mamute.GetComponent<MamuteBehaviour>().resistencia / GetComponent<BattleController>().penaltyDef);*/
                    dano = 100;
                    Mamute.GetComponent <MamuteBehaviour>().battleLife = Mamute.GetComponent <MamuteBehaviour>().battleLife - dano;
                }
            }

            DamageTxt.SetActive(true);
            DamageTxt.GetComponent <TextMesh>().text = dano.ToString();
            enemyRoundDone = true;
        }
    }
	// Update is called once per frame
	void Update () {

        vidaEnemy = Enemie.gameObject.GetComponent<UIEnemy>().enemyLife;

        if (monstroAtivo == "Aguia")
        {

            vidaPlayer = Aguia.GetComponent<AguiaBehaviour>().battleLife;

        }
        else if (monstroAtivo == "Mamute")
        {

            vidaPlayer = Mamute.GetComponent<MamuteBehaviour>().battleLife;

        }
        else
        {

            vidaPlayer = Peixe.GetComponent<PeixeBehaviour>().battleLife;

        }

        //VERIFICAR A DERROTA
        if (vidaEnemy <= 0)
        {
            Aguia.GetComponent<AguiaBehaviour>().AguiaPrefab.SetActive(false);
            Mamute.GetComponent<MamuteBehaviour>().MamutePrefab.SetActive(false);
            Peixe.GetComponent<PeixeBehaviour>().peixePrefab.SetActive(false);

            Peixe.GetComponent<PeixeBehaviour>().UI.SetActive(false);
            Aguia.GetComponent<AguiaBehaviour>().UI.SetActive(false);
            Mamute.GetComponent<MamuteBehaviour>().UI.SetActive(false);

            HabAtk.SetActive(false);
            HabDef.SetActive(false);

            Peixe.GetComponent<PeixeBehaviour>().load = false;
            Aguia.GetComponent<AguiaBehaviour>().load = false;
            Mamute.GetComponent<MamuteBehaviour>().load = false;


            Application.LoadLevel("GAME_OVER");

        }

        else if (vidaPlayer <= 0)
        {
            Aguia.GetComponent<AguiaBehaviour>().AguiaPrefab.SetActive(false);
            Mamute.GetComponent<MamuteBehaviour>().MamutePrefab.SetActive(false);
            Peixe.GetComponent<PeixeBehaviour>().peixePrefab.SetActive(false);

            Peixe.GetComponent<PeixeBehaviour>().UI.SetActive(false);
            Aguia.GetComponent<AguiaBehaviour>().UI.SetActive(false);
            Mamute.GetComponent<MamuteBehaviour>().UI.SetActive(false);

            HabAtk.SetActive(false);
            HabDef.SetActive(false);

            Peixe.GetComponent<PeixeBehaviour>().load = false;
            Aguia.GetComponent<AguiaBehaviour>().load = false;
            Mamute.GetComponent<MamuteBehaviour>().load = false;

           
            Application.LoadLevel("GAME_OVER");
        }

        //====================== VERIFICAR A DERROA FIM

        if (Input.GetKey(KeyCode.Escape))
        {
            Aguia.GetComponent<AguiaBehaviour>().AguiaPrefab.SetActive(true);
            Mamute.GetComponent<MamuteBehaviour>().MamutePrefab.SetActive(true);
            Peixe.GetComponent<PeixeBehaviour>().peixePrefab.SetActive(true);

            Peixe.GetComponent<PeixeBehaviour>().UI.SetActive(true);
            Aguia.GetComponent<AguiaBehaviour>().UI.SetActive(true);
            Mamute.GetComponent<MamuteBehaviour>().UI.SetActive(true);

            HabAtk.SetActive(true);
            HabDef.SetActive(true);

            Peixe.GetComponent<PeixeBehaviour>().load = false;
            Aguia.GetComponent<AguiaBehaviour>().load = false;
            Mamute.GetComponent<MamuteBehaviour>().load = false;

            Application.LoadLevel("LABORATORIO");
        }

        /*TUDO NOVO*/
        if (pressletters == true)
        {
            HabAtk.SetActive(false);
            HabDef.SetActive(false);
            PressLetters();

            //Essa operaçao serve para começar o timer
            if (clicked == false && timerLetters > 0)
            {

                timerLetters -= Time.deltaTime;

            }
            //Essa operaçao sera verdeira se o jogador nao conseguir clicar em todas as letras
            if (clicked == false && timerLetters <= 0)
            {

                if (primeiroJogador == true)
                {
                    penaltyAtk = penaltyAtk + 2;
                }
                if (primeiroJogador == false)
                {
                    penaltyDef = penaltyDef + 2;
                }

                SetLetters();
                timerLetters = 4.0f;
                pressletters = false;
                clickControl = 0;
            }

            //Essa operacao serve para quando o jogador conseguir clicar em todas as letras
            if (clickControl > 6 && clicked == true)
            {
                clickControl = 0;
                timerLetters = 4.0f;
                SetLetters();
                pressletters = false;
            }

        }
        if (pressButton == false && pressletters == false)
        {

            if (atkPress == 1)
            {
                if (monstroAtivo == "Aguia")
                {
                    AguiaPrefab.GetComponent<Animator>().SetInteger("animCondition", 1);
                }
                else if (monstroAtivo == "Peixe")
                {
                    PeixePrefab.GetComponent<Animator>().SetInteger("animCondition", 1);
                }
                else if (monstroAtivo == "Mamute")
                {
                    MamutePrefab.GetComponent<Animator>().SetInteger("animCondition", 1);
                }
                atk1++;
                round++;
                atkPress = 0;

            }
            else if (atkPress == 2)
            {
                if (monstroAtivo == "Aguia")
                {
                    AguiaPrefab.GetComponent<Animator>().SetInteger("animCondition", 2);
                }
                else if (monstroAtivo == "Peixe")
                {
                    PeixePrefab.GetComponent<Animator>().SetInteger("animCondition", 2);
                }
                else if (monstroAtivo == "Mamute")
                {
                    MamutePrefab.GetComponent<Animator>().SetInteger("animCondition", 2);
                }
                atk2++;
                round++;
                atkPress = 0;
            }


            if (defPress == 3)
            {
                if (monstroAtivo == "Aguia")
                {
                    AguiaPrefab.GetComponent<Animator>().SetInteger("animCondition", 3);
                }
                else if (monstroAtivo == "Peixe")
                {
                    PeixePrefab.GetComponent<Animator>().SetInteger("animCondition", 3);
                }
                else if (monstroAtivo == "Mamute")
                {
                    MamutePrefab.GetComponent<Animator>().SetInteger("animCondition", 3);
                }
                def1++;
                round++;
                defPress = 0;

            }
            else if (defPress == 4)
            {
                if (monstroAtivo == "Aguia")
                {
                    AguiaPrefab.GetComponent<Animator>().SetInteger("animCondition", 4);
                }
                else if (monstroAtivo == "Peixe")
                {
                    PeixePrefab.GetComponent<Animator>().SetInteger("animCondition", 4);
                }
                else if (monstroAtivo == "Mamute")
                {
                    MamutePrefab.GetComponent<Animator>().SetInteger("animCondition", 4);
                }
                def2++;
                round++;
                defPress = 0;
            }
        }

    }