void ApareceComHitNoChao(GameObject gameObject) { if (!addView) { addView = true; CreatureManager aAlvo = (gameObject.name == "CriatureAtivo") ? GameController.g.InimigoAtivo : GameController.g.Manager.CriatureAtivo; Transform alvo = (aAlvo != null) ? aAlvo.transform : null; Vector3 volta = gameObject.transform.position; if (alvo != null) { volta = alvo.position; DirDeREpulsao = Vector3.ProjectOnPlane(alvo.position - gameObject.transform.position, Vector3.up).normalized; bool b = aAlvo.IA.NavAtiva() || aAlvo.Mov.NoChao(aAlvo.MeuCriatureBase.CaracCriature.distanciaFundamentadora); //alvo.GetComponent<Animator>().GetBool("noChao"); bool c = alvo.GetComponent <CharacterController>().enabled; MonoBehaviour.Destroy( MonoBehaviour.Instantiate( GameController.g.El.retorna(noImpacto.ToString()), alvo.position, Quaternion.identity), 10); Debug.Log("hitNoChao: " + b + " : " + c); if (b && c) { Dano.VerificaDano(aAlvo.gameObject, gameObject, this); } } MonoBehaviour.Destroy( MonoBehaviour.Instantiate( GameController.g.El.retorna(Nome.ToString()), volta, Quaternion.identity), 10); gameObject.transform.position = new melhoraPos().novaPos(volta); ApareceDesaparece(true, gameObject); } }
protected void facaImpacto(GameObject emQ, bool destroiAqui = true, bool noTransform = false) { /* * * if (emQ.gameObject.tag == "eventoComGolpe" && !GameController.g.estaEmLuta) * { * emQ.GetComponent<EventoComGolpe>().DisparaEvento(esseGolpe.Nome); * }*/ GameObject impacto = elementosDoJogo.el.retorna(noImpacto); if (!noTransform) { impacto = (GameObject)Instantiate(impacto, transform.position, Qparticles); } // if (emQ.tag == "Criature") //{ // Atributos A = emQ.GetComponent<CreatureManager>().MeuCriatureBase.CaracCriature.meusAtributos; //if (A!=null) // if (A.PV.Corrente > 0) Dano.VerificaDano(emQ, dono, esseGolpe); if (noTransform) { impacto = (GameObject)Instantiate(impacto, emQ.transform.position, Qparticles); } /* * if (colocaImpactos) * aG.impactos++; */ // } if (impacto) { Destroy(impacto, 1.5f); } if (destroiAqui) { Destroy(gameObject); } }
void OnTriggerEnter(Collider emQ) { if (emQ.tag == "Criature" || emQ.tag == "Player") { bool dano = true; bool deFogo = false; if (emQ.tag == "Criature") { nomeTipos[] Tipos = emQ.transform.GetComponent <CreatureManager>().MeuCriatureBase.CaracCriature.meusTipos; for (int i = 0; i < Tipos.Length; i++) { if (Tipos[i] == tipoImune) { dano = false; deFogo = true; } } } else { dano = false; } if (!deFogo) { GameObject G = elementosDoJogo.el.retorna(noImpacto); G = (GameObject)Instantiate(G, emQ.transform.position, Quaternion.identity); Destroy(G, 0.75f); } if (dano) { Dano.VerificaDano(emQ.gameObject, emQ.gameObject, new GolpeBase(new ContainerDeCaracteristicasDeGolpe())); } if (!deFogo) { Destroy(gameObject); } } }
public override void UpdateGolpe(GameObject G) { tempoDecorrido += Time.deltaTime; if (!addView) { GolpePersonagem golpeP = GolpePersonagem.RetornaGolpePersonagem(G, Nome); if (golpeP.TempoDeInstancia > 0) { posInicial = Emissor.UseOEmissor(G, Nome); } AuxiliarDeInstancia.InstancieEDestrua(Nome, posInicial, DirDeREpulsao, TempoDeDestroy); addView = true; } hit = new RaycastHit(); Vector3 ort = Vector3.Cross(DirDeREpulsao, Vector3.up).normalized; float deslocadorInicial = tempoDecorrido > 1 ? tempoDecorrido : 1; float deslocadorFinal = tempoDecorrido < 0.7f ? tempoDecorrido : 0.7f; if (tempoDecorrido < TempoDeDestroy) { Debug.DrawLine(posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao, posInicial + DirDeREpulsao * 25 * deslocadorFinal, Color.red); Debug.DrawLine( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao + 0.25f * Vector3.up, posInicial + 0.25f * Vector3.up + DirDeREpulsao * 25 * deslocadorFinal, Color.red); Debug.DrawLine( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao - 0.25f * Vector3.up, posInicial - 0.25f * Vector3.up + DirDeREpulsao * 25 * deslocadorFinal, Color.red); Debug.DrawLine( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao - 0.25f * ort, posInicial - 0.25f * ort + DirDeREpulsao * 25 * deslocadorFinal, Color.red); if (Physics.Linecast(posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao, posInicial + DirDeREpulsao * 25 * tempoDecorrido, out hit) || Physics.Linecast( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao - 0.25f * Vector3.up, posInicial - 0.25f * Vector3.up + DirDeREpulsao * 25 * tempoDecorrido, out hit) || Physics.Linecast( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao - 0.25f * ort, posInicial - 0.25f * ort + DirDeREpulsao * 25 * tempoDecorrido, out hit) || Physics.Linecast( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao + 0.25f * ort, posInicial + 0.25f * ort + DirDeREpulsao * 25 * tempoDecorrido, out hit) ) { if (impactos % 10 == 0) { GameObject Golpe = GameController.g.El.retorna(DoJogo.impactoDeAgua); Object impacto = MonoBehaviour.Instantiate(Golpe, hit.point, Quaternion.identity); MonoBehaviour.Destroy(impacto, 0.5f); if (impactos == 0) { Dano.VerificaDano(hit.transform.gameObject, G, this); } } impactos++; } } }