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()); }
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; } } }
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); }