Beispiel #1
0
    void caiPedra()
    {
        ChecaIni checa = checaini.GetComponent <ChecaIni>();
        float    posx  = Random.Range(vet1.transform.position.x, vet2.transform.position.x);
        Vector3  pos   = new Vector3(posx, vet1.transform.position.y, -1);
        int      i     = Random.Range(0, 100);

        Instantiate(pedraObj, pos, Quaternion.identity);
        pedrasN += 1;
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        ChecaIni   checa = checaini.GetComponent <ChecaIni>();
        Collider2D toqueTele;

        toqueTele = Physics2D.OverlapCircle(tele.transform.position, 0.1f, layerPC);
        if (toqueTele && checa.Nini <= 0 && loja == false && boss == false)
        {
            lacoRespawn();
            PC.transform.position = new Vector3(spawn.transform.position.x, spawn.transform.position.y, PC.transform.position.z);
            cacadoraScript scriPC = PC.GetComponent <cacadoraScript>();
            tesouroAleatorio();
            armadilhaSpawn();
            scriPC.vigor = scriPC.vigorMax - 1;
        }
        if (toqueTele && checa.Nini <= 0 && loja == true && boss == false)
        {
            respawnItem();
            PC.transform.position = new Vector3(spawn.transform.position.x, spawn.transform.position.y, PC.transform.position.z);
            cacadoraScript scriPC = PC.GetComponent <cacadoraScript>();
            scriPC.vigor = scriPC.vigorMax - 1;
        }
        if (toqueTele && checa.Nini <= 0 && loja == false && boss == true)
        {
            if (fase == 1)
            {
                //Bearman scr = bossObj.gameObject.GetComponent<Bearman>();
                //scr.ativo = true;

                PC.transform.position = new Vector3(spawn.transform.position.x, spawn.transform.position.y, PC.transform.position.z);
                cacadoraScript scriPC = PC.GetComponent <cacadoraScript>();
                scriPC.vigor = scriPC.vigorMax - 1;
            }
            if (fase == 2)
            {
                // golemBoss scr = bossObj.gameObject.GetComponent<golemBoss>();
                // scr.ativo = true;

                PC.transform.position = new Vector3(spawn.transform.position.x, spawn.transform.position.y, PC.transform.position.z);
                cacadoraScript scriPC = PC.GetComponent <cacadoraScript>();
                scriPC.vigor = scriPC.vigorMax - 1;
            }
            if (fase == 3)
            {
                // RatoAmareloBoss scr = bossObj.gameObject.GetComponent<RatoAmareloBoss>();
                // scr.ativo = true;

                PC.transform.position = new Vector3(spawn.transform.position.x, spawn.transform.position.y, PC.transform.position.z);
                cacadoraScript scriPC = PC.GetComponent <cacadoraScript>();
                scriPC.vigor = scriPC.vigorMax - 1;
            }
        }
    }
Beispiel #3
0
 void morrer()
 {
     if (!morreu)
     {
         morreu = true;
         ChecaIni checa = checaini.GetComponent <ChecaIni>();
         checa.morreuUm();
         anim.SetTrigger("morrendo");
         drop();
         Destroy(this.gameObject, 1f);
         rbd.velocity = new Vector2(0, rbd.velocity.y);
     }
 }
 // Use this for initialization
 void Start()
 {
     morreu      = false;
     rbd         = GetComponent <Rigidbody2D>();
     anim        = GetComponent <Animator>();
     PC          = GameObject.FindGameObjectWithTag("Player");
     checaini    = GameObject.FindGameObjectWithTag("checaIni");
     vida        = vidaMax;
     ativo       = false;
     contTele    = 3;
     esperSummon = 30;
     checa       = checaini.GetComponent <ChecaIni>();
 }
Beispiel #5
0
 void morrer()
 {
     if (!morreu)
     {
         if (vida <= 0 && estaNoChao)
         {
             morreu = true;
             ChecaIni checa = checaini.GetComponent <ChecaIni>();
             checa.morreuBoss();
             anim.SetTrigger("morreu");
             drop();
             Destroy(this.gameObject, 1.1f);
         }
     }
 }
Beispiel #6
0
 void morrer()
 {
     if (!morreu)
     {
         if (vida <= 0)
         {
             morreu = true;
             ChecaIni checa = checaini.GetComponent <ChecaIni>();
             checa.morreuUm();
             anim.SetTrigger("morreu");
             drop();
             Destroy(this.gameObject, 0.7f);
         }
     }
 }
Beispiel #7
0
 void morrer()
 {
     if (!morreu)
     {
         if (vida <= 0)
         {
             morreu = true;
             PlaySingle(morre, 1);
             ChecaIni checa = checaini.GetComponent <ChecaIni>();
             checa.morreuUm();
             anim.SetBool("morrendo", true);
             drop();
             Destroy(this.gameObject, 0.5f);
         }
     }
 }
Beispiel #8
0
    // Update is called once per frame
    void Update()
    {
        ChecaIni   checa = checaini.GetComponent <ChecaIni>();
        Collider2D toqueTele;

        toqueTele = Physics2D.OverlapCircle(tele.transform.position, 0.1f, layerPC);
        if (toqueTele && checa.boss == 0 && Fase == 1)
        {
            abriu = true;
            float x = Input.GetAxis("Vertical");
            if (x > 0.5)
            {
                GameObject gStatus = GameObject.FindGameObjectWithTag("gameStatus");
                GameStatus GS      = gStatus.GetComponent <GameStatus>();
                GS.saveStatus();
                SceneManager.LoadScene(2);
            }
        }
        if (toqueTele && Fase == 2)
        {
            abriu = true;
            float x = Input.GetAxis("Vertical");
            if (x > 0.5)
            {
                GameObject gStatus = GameObject.FindGameObjectWithTag("gameStatus");
                GameStatus GS      = gStatus.GetComponent <GameStatus>();
                GS.saveStatus();
                SceneManager.LoadScene(3);
            }
        }
        if (toqueTele && Fase == 3)
        {
            abriu = true;
            float x = Input.GetAxis("Vertical");
            if (x > 0.5)
            {
                GameObject gStatus = GameObject.FindGameObjectWithTag("gameStatus");
                GameStatus GS      = gStatus.GetComponent <GameStatus>();
                GS.saveStatus();
                SceneManager.LoadScene(4);
            }
        }
    }
Beispiel #9
0
    void spawnaItem()
    {
        ChecaIni checa = checaini.GetComponent <ChecaIni>();
        Vector3  pos   = new Vector3(this.transform.position.x, this.transform.position.y + 2, this.transform.position.z - 1);
        Vector3  pos2  = new Vector3(this.transform.position.x - 2, this.transform.position.y + 2, this.transform.position.z - 1);
        Vector3  pos3  = new Vector3(this.transform.position.x + 2, this.transform.position.y + 2, this.transform.position.z - 1);

        if (checa.Nini <= 0 && spawnou == false)
        {
            if (tipo == 1)
            {
                anim.SetTrigger("abriu");
                Instantiate(moeda, pos, Quaternion.identity);
                Instantiate(moeda, pos2, Quaternion.identity);
                Instantiate(moeda, pos3, Quaternion.identity);
            }
            if (tipo == 2)
            {
                Instantiate(pocao, pos, Quaternion.identity);
            }
            spawnou = true;
        }
    }
Beispiel #10
0
    void respawn()
    {
        ChecaIni checa = checaini.GetComponent <ChecaIni>();
        float    posx  = Random.Range(vet1.transform.position.x, vet2.transform.position.x);
        Vector3  pos   = new Vector3(posx, vet1.transform.position.y, -1);
        int      i     = Random.Range(0, 100);
        int      aux   = vetIni.Length;

        if (aux == 2)
        {
            if (i < 50)
            {
                Debug.Log("DEU ZERO");
                Instantiate(vetIni[0], pos, Quaternion.identity);
                auxlimite   = 1;
                checa.Nini += 1;
                Debug.Log("SUMONO GERAL");
            }
            if (i >= 50)
            {
                Debug.Log("DEU UM");
                Instantiate(vetIni[1], pos, Quaternion.identity);
                auxlimite   = 2;
                checa.Nini += 1;
                Debug.Log("SUMONO GERAL");
            }
        }

        if (aux == 3)
        {
            if (i < 33)
            {
                Debug.Log("DEU ZERO");
                Instantiate(vetIni[0], pos, Quaternion.identity);
                auxlimite   = 1;
                checa.Nini += 1;
                Debug.Log("SUMONO GERAL");
            }
            if (i >= 33 && i < 66)
            {
                Debug.Log("DEU UM");
                Instantiate(vetIni[1], pos, Quaternion.identity);
                auxlimite   = 2;
                checa.Nini += 1;
                Debug.Log("SUMONO GERAL");
            }
            if (i >= 66)
            {
                Debug.Log("DEU DOIS");
                Instantiate(vetIni[2], pos, Quaternion.identity);
                auxlimite   = 3;
                checa.Nini += 1;
                Debug.Log("SUMONO GERAL");
            }
        }
        if (aux == 4)
        {
            if (i < 25)
            {
                Debug.Log("DEU ZERO");
                Instantiate(vetIni[0], pos, Quaternion.identity);
                auxlimite   = 1;
                checa.Nini += 1;
                Debug.Log("SUMONO GERAL");
            }
            if (i >= 25 && i < 50)
            {
                Debug.Log("DEU UM");
                Instantiate(vetIni[1], pos, Quaternion.identity);
                auxlimite   = 2;
                checa.Nini += 1;
                Debug.Log("SUMONO GERAL");
            }
            if (i >= 50 && i < 75)
            {
                Debug.Log("DEU DOIS");
                Instantiate(vetIni[2], pos, Quaternion.identity);
                auxlimite   = 3;
                checa.Nini += 1;
                Debug.Log("SUMONO GERAL");
            }
            if (i >= 75)
            {
                Debug.Log("DEU DOIS");
                Instantiate(vetIni[3], pos, Quaternion.identity);
                auxlimite   = 3;
                checa.Nini += 1;
                Debug.Log("SUMONO GERAL");
            }
        }
    }