예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (countGF > 1)
     {
         gfManager.GameOver();
     }
 }
예제 #2
0
파일: GF.cs 프로젝트: Chrezende/PoliGame
    // Método que realiza as ações da Namorada
    #region Método de Açao

    void Acao()
    {
        //Definir o que será feito
        switch (Fazer_Algo)
        {
            #region Geladeira
        case 1:
            if (Escada == false && Movendo == false)
            {
                if (Chegou)
                {
                    Debug.Log("Saciou a fome");
                    Happy += happyIncrease * 2;
                    poke--;
                    //startMarker = this.transform.position;
                    Chegou = false;
                    emotes.ShowEmote(5);
                    which      = 5;
                    Fazer_Algo = 0;
                }
                else
                {
                    emotes.ShowEmote(1);
                    GF_Want2Go(startMarker, objetos.Geladeira.position, objetos.AndarG);
                }
            }
            break;
            #endregion

            #region Banheiro
        case 2:

            if (Escada == false && Movendo == false)
            {
                if (Chegou)
                {
                    Debug.Log("Foi no banheiro");
                    Happy += happyIncrease + 15;
                    Chegou = false;
                    poke--;
                    //startMarker = this.transform.position;
                    emotes.ShowEmote(5);
                    which      = 5;
                    Fazer_Algo = 0;
                }
                else
                {
                    emotes.ShowEmote(2);
                    GF_Want2Go(startMarker, objetos.Banheiro.position, objetos.AndarB);
                }
            }
            break;
            #endregion

            #region Telefone
        case 3:
            if (telController.isRinging)
            {
                if (Escada == false && Movendo == false)
                {
                    if (Chegou)
                    {
                        Debug.Log("Atendeu o telefone");
                        telController.isRinging = false;
                        Chegou = false;
                        gfManager.GameOver();
                    }
                    else
                    {
                        emotes.ShowEmote(3);
                        GF_Want2Go(startMarker, objetos.Telefone.position, objetos.AndarT);
                    }
                }
            }
            else
            {
                Fazer_Algo = 8;
            }

            break;
            #endregion

            #region TV
        case 4:
            if (Escada == false && Movendo == false)
            {
                if (Chegou)
                {
                    Debug.Log("Foi Aender a porta");
                    Happy += happyIncrease + 25;
                    poke--;
                    Chegou = false;
                    emotes.ShowEmote(5);
                    which      = 5;
                    Fazer_Algo = 0;
                }
                else
                {
                    emotes.ShowEmote(4);
                    GF_Want2Go(startMarker, objetos.TV.position, objetos.AndarTV);
                }
            }
            break;
            #endregion

            #region Cama
        case 5:                //Cama
            if (Escada == false && Movendo == false)
            {
                if (Chegou)
                {
                    Chegou     = false;
                    which      = 0;
                    Fazer_Algo = 0;
                }
                else
                {
                    emotes.ShowEmote(8);
                    GF_Want2Go(startMarker, objetos.Cama.position, objetos.AndarC);
                }
            }

            break;
            #endregion

            #region Teste de Felicidade
        case 6:                 //Teste de Felicidade

            // Verifica a "Felicidade" da Namorda --> ao ficar zero ela fica brava e vai embora(Gera GameOver), ao ficar feliz ela também vai embora (Gera 1 Sucesso)
            if ((Happy == 0 || Happy == 100) && Escada == false && Movendo == false)
            {
                if (Chegou)
                {
                    Chegou = false;
                    Debug.Log("Fim");
                    if (Happy == 0)
                    {
                        gfManager.GameOver();
                    }
                    else
                    {
                        Destroy(this.gameObject);
                    }
                }
                else
                {
                    if (Happy == 0)
                    {
                        emotes.ShowEmote(7);
                    }
                    else
                    {
                        emotes.ShowEmote(5);
                    }
                    GF_Want2Go(startMarker, objetos.Outdoor.position, objetos.AndarO);
                }
            }

            break;
            #endregion

            #region "Atrapalhar"
        case 7:                 //Atrapalhar Movimento

            if (!Seguindo)
            {
                Seguindo  = true;
                player2GF = this.transform.position - player.transform.position;
                teste     = player2GF;
                teste.x   = -player2GF.x;
                GetComponent <BoxCollider2D>().enabled = false;
            }

            float para_onde = this.transform.position.x + player.translation;

            if (para_onde < this.transform.position.x)
            {
                if (goingRight && !player.direita)
                {
                    transform.Rotate(0, 180, 0);
                    goingRight = false;
                }
            }
            else
            {
                if (!goingRight && player.direita)
                {
                    transform.Rotate(0, 180, 0);
                    goingRight = true;
                }
            }

            break;
            #endregion

            #region Retornar ao local anterior
        case 8:     //Retornar

            if (Chegou)
            {
                //startMarker = this.transform.position;
                Chegou     = false;
                Fazer_Algo = 0;
            }
            else
            {
                emotes.ShowEmote(0);
                which       = 0;
                startMarker = this.transform.position;
                GF_Want2Go(this.transform.position, oldStartMarker, oldAndar);
            }
            break;
            #endregion

        default:
            emotes.ShowEmote(0);
            break;
        }
    }