Example #1
0
    public void Morte()
    {
        if (Morto)
        {
            return;
        }

        Morto = true;
        GameObject.FindGameObjectWithTag("Player").GetComponent <Atributos>().RegenVida();
        GetComponent <CapsuleCollider>().enabled = false;
        GetComponent <Rigidbody>().useGravity    = false;
        GetComponent <Rigidbody>().isKinematic   = true;
        anim.SetTrigger("Morte");
        agent.isStopped = true;
        Atacando        = false;
        Morto           = true;
        Instantiate(particulaMorte, transform.position, Quaternion.identity);
        SFX.DisparoSFX(somMorte, transform.position);
        var saidas = FindObjectsOfType <Saida>();

        for (int x = 0; x < saidas.Length; x++)
        {
            saidas[x].AtivarSaida();
        }

        Destroy(gameObject, 5f);
    }
    public void Morte()
    {
        Morto = true;
        GetComponent <CapsuleCollider>().enabled = false;
        anim.SetTrigger("Morte");
        Instantiate(particulaMorte, transform.position, Quaternion.identity);
        SFX.DisparoSFX(somMorte, transform.position);
        var inimigos = FindObjectsOfType <ControleDeAnimacaoInimigo>();

        for (int x = 0; x < inimigos.Length; x++)
        {
            inimigos[x].Venceu();
        }
        StartCoroutine(NovoJogo());
    }
Example #3
0
    public void ReceberDano(int dano)
    {
        vidaAtual -= dano;
        Instantiate(particulaSofrerDano, transform.position, Quaternion.identity);
        SFX.DisparoSFX(somSofrerDano, transform.position);
        if (vidaAtual <= 0)
        {
            switch (tag)
            {
            case "Player":
                GetComponent <ControleDeAnimacao>().Morte();
                break;

            case "Enemy":
                GetComponent <ControleDeAnimacaoInimigo>().Morte();
                break;
            }
        }
    }
Example #4
0
 void AplicaDano(GameObject gbj)
 {
     gbj.transform.GetComponent <Atributos>().ReceberDano(Principal.GetComponent <Atributos>().dano);
     Instantiate(particulaDesferirGolpe, gbj.transform.position, Quaternion.identity);
     SFX.DisparoSFX(somDesferirDano, transform.position);
 }