Exemplo n.º 1
0
 void Update()
 {
     if (controladorCena.state.Buttons.Start == ButtonState.Pressed)
     {
         controladorCena.CarregarCena("jogo");
     }
 }
Exemplo n.º 2
0
 void Update()
 {
     if (Input.anyKeyDown)
     {
         controladorCena.CarregarCena("início");
     }
 }
Exemplo n.º 3
0
    void Update()
    {
        if (controladorCena.state.Buttons.Start == ButtonState.Pressed)
        {
            controladorCena.CarregarCena("intro2");
        }

        if (transform.position == posicao1)
        {
            MoverPara(posicao2);
        }
        else if (transform.position == posicao2)
        {
            MoverPara(posicao1);
        }
    }
Exemplo n.º 4
0
 void ProximaImagem()
 {
     imagemAtual++;
     if (imagemAtual < imagens.Count)
     {
         spriteRenderer.sprite = imagens[imagemAtual];
     }
     else
     {
         controladorCena.CarregarCena("início");
     }
 }
Exemplo n.º 5
0
    void Update()
    {
        if (anyKeyRestart && Input.anyKeyDown)
        {
            controladorCena.CarregarCena("início");
        }

        if (Input.GetKeyDown(KeyCode.O) || Input.GetKeyDown("joystick button 9"))
        {
            ColetarAlma(jogador.gameObject);
        }

        if (Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown("joystick button 6"))
        {
            desenharLinecast = !desenharLinecast;
        }

        if (desenharLinecast)
        {
            if (!npcLinecast)
            {
                GameObject[] npcs = GameObject.FindGameObjectsWithTag("NPC");
                if (npcs.Count() > 0)
                {
                    npcLinecast = npcs[0];
                }
            }

            if (npcLinecast)
            {
                npcLinecast.GetComponent <NPC>().desenharLinecast = true;
            }
        }
        else
        {
            if (npcLinecast)
            {
                npcLinecast.GetComponent <NPC>().desenharLinecast = false;
            }
        }

        if (Input.GetKeyDown(KeyCode.F12) || (controladorCena.jogoPausado && Input.GetKeyDown("joystick button 8")))
        {
            controladorCena.CarregarCena("início");
        }

        if (controladorCena.jogoPausado)
        {
            return;
        }

        AtualizarRelogio();

        AtualizarBotoesAuxilio();
        AtualizarBotoesAuxilioTextos();

        bool  comandoLiberado = false;
        float delay           = delayComando;

        if (cameraBotaoZoomLiberado && controladorCena.state.Buttons.LeftShoulder == ButtonState.Pressed)
        {
            cameraBotaoZoomLiberado = false;
            AlterarCameraZoom();
        }
        else if (!cameraBotaoZoomLiberado && controladorCena.state.Buttons.LeftShoulder == ButtonState.Released)
        {
            cameraBotaoZoomLiberado = true;
        }

        if (jogador.comandosHabilitados && Time.time > tempoUltimoComando)
        {
            if (alterarEstadoBotoesAuxilioLiberado && controladorCena.state.Buttons.RightShoulder == ButtonState.Pressed)
            {
                alterarEstadoBotoesAuxilioLiberado = false;
                AlterarEstadoBotoesAuxilio();
            }
            else if (!alterarEstadoBotoesAuxilioLiberado && controladorCena.state.Buttons.RightShoulder == ButtonState.Released)
            {
                alterarEstadoBotoesAuxilioLiberado = true;
            }

            if (Input.GetButtonDown("InteragirLuz"))
            {
                if (jogador.comandosComunsHabilitados && personagem.luzComodoAtual && Time.time > tempoAlterarLuz)
                {
                    StartCoroutine(OscilarLuzComodo());
                    comandoLiberado = true;
                }
            }
            else if (Input.GetButtonDown("IniciarInteraçãoObjeto"))
            {
                comandoLiberado = true;

                Objeto objetoMarcado = jogador.objetoMarcado ? jogador.objetoMarcado.GetComponent <Objeto>() : null;
                if (jogador.objetoMarcado && !jogador.objetoInteracao && (objetoMarcado && (objetoMarcado.chamarAtencaoLiberado || (objetoMarcado.assustar && (objetoMarcado.ultimoAssustar == 0 || Time.time > objetoMarcado.ultimoAssustar + objetoMarcado.delayAssustar)))))
                {
                    jogador.IniciarInteracao();
                }
                else if (jogador.objetoInteracao)
                {
                    jogador.EncerrarInteracao();
                }
                else
                {
                    comandoLiberado = false;
                }
            }
            else if (Input.GetButtonDown("Interagir"))
            {
                comandoLiberado = true;
                if (jogador.objetoInteracao)
                {
                    Objeto objeto = jogador.objetoInteracao.GetComponent <Objeto>();
                    if (!objeto.chamandoAtencao && objeto.chamarAtencaoLiberado)
                    {
                        //Debug.Log("ChamarAtencao");
                        objeto.ChamarAtencao();
                    }
                    else if (objeto.chamandoAtencao && objeto.encerrarChamarAtencao)
                    {
                        //Debug.Log("EncerrarChamarAtencao");
                        objeto.EncerrarChamarAtencao();
                    }
                    else if (objeto.assustar && !objeto.assustando && (objeto.ultimoAssustar == 0 || Time.time > objeto.ultimoAssustar + objeto.delayAssustar))
                    {
                        objeto.Assustar();
                    }
                    else
                    {
                        comandoLiberado = false;
                    }
                }
                else
                {
                    jogador.Assustar();
                }
            }
        }

        bool comandoPressionado = false;

        List <string> teclas = new List <string>(new string[] {
            "InteragirLuz",
            "IniciarInteraçãoObjeto",
            "Interagir"
        });

        foreach (string tecla in teclas)
        {
            if (Input.GetButtonDown(tecla))
            {
                comandoPressionado = true;

                /*
                 * if (comandoLiberado)
                 *      delay += delayComandoLiberado;
                 */

                break;
            }
        }

        if (comandoLiberado)
        {
            tempoUltimoComando = Time.time + delay;
        }
        else if (comandoPressionado)
        {
            // ComandoDesativado();

            if (Time.time > tempoUltimoComando)
            {
                tempoUltimoComando = Time.time + delayComandoDesativado;
            }
        }
    }