public void IniciaApresentacaoDoBoss(Vector3 posParaParticulaDeOrigem) { GameController.g.LocalName.RequestLocalNameExibition("O mago Seta Sombria", false, 3); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.aparicaoSurpresaDeInimigo)); EventAgregator.Publish(EventKey.abriuPainelSuspenso); InstanciaLigando.Instantiate(particulaDoTeleport, posParaParticulaDeOrigem, 5); new MyInvokeMethod().InvokeNoTempoDeJogo(AparicaoPreRisada, .5f); }
protected override void Telegrafar(Vector3 charPos) { FlipDirection.Flip(transform, charPos.x - transform.position.x); InstanciaLigando.Instantiate(particulaTelegrafista, transform.position, 5); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.Wind1)); }
protected override void OnFinishTalk() { bloqueioPorFazer.SetActive(true); InstanciaLigando.Instantiate(particulaDoBloqueio, bloqueioPorFazer.transform.position, 5); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.pedrasQuebrando)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.returnRememberedMusic)); containerDoBoss.IniciaApresentacaoDoBoss(transform.position); gameObject.SetActive(false); }
protected override void RequestAction(Vector3 charPos) { FlipDirection.Flip(transform, charPos.x - transform.position.x); InstanciaLigando.Instantiate(particulaDoSpawn, transform.position, 5); GameObject G = InstanciaLigando.Instantiate(breed, transform.position); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.lancaProjetilInimigo)); spawnados.Add(G); RetornarParaEsperaZerandoTempo(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { bool sentidoPositivo = transform.position.x - collision.transform.position.x > 0; EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.heroDamage, sentidoPositivo, 25)); } //Debug.Log(collision.tag + " : " + collision.name); if (collision.tag != "Enemy" && collision.tag != "triggerGeral" && collision.tag != "attackCollisor" && collision.gameObject.layer != 12) { InstanciaLigando.Instantiate(Particle, transform.position, 2); EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.request3dSound, SoundEffectID.Break, 1f)); Destroy(gameObject); } if (collision.tag == "attackCollisor") { gameObject.tag = "attackCollisor"; Vector3 plusDir = Vector3.zero; switch (collision.gameObject.name) { case "colisorDeAtaqueComum": plusDir = Mathf.Sign(GameController.g.Manager.transform.localScale.x) * Vector2.right; break; case "colisorDoAtaquebaixo": plusDir = Vector3.down; break; case "colisorDoAtaqueAlto": plusDir = Vector3.up; break; } Dir = -Dir + plusDir; if (Dir != Vector3.zero) { Dir = Dir.normalized; } else { Dir = plusDir; } new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, () => { EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.request3dSound, SoundEffectID.Break, 1f)); }, .15f); } }
void IniciaProjetil() { _Animator.SetTrigger("telegrafarProjetil"); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.Wind1)); InstanciaLigando.Instantiate(particulaTelegrafista, transform.GetChild(1).position, 5); new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, PosTelegrafarProjetil, tempoTelegrafandoProjetil); new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, PosProjetil, intervalosDeMagias); estado = EstadoDaqui.emAtaque; }
void Particularizar() { if (gameObject != null) { if (iniciarParticulas) { EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.request3dSound, somDasParticulas)); InstanciaLigando.Instantiate(particulaTelegrafista, transform.position, 2); new MyInvokeMethod().InvokeNoTempoDeJogo(Particularizar, intervaloDeParticulas); } } }
void Update() { switch (estado) { case EstadoDaqui.movendo: UpdateMovendo(); break; case EstadoDaqui.telegrafando: TempoDecorrido += Time.deltaTime; if (TempoDecorrido > TEMPO_TELEGRAFANDO) { Mov.AplicadorDeMovimentos(DirecaoNoPlano.NoUpNormalizado(transform.position, GameController.g.Manager.transform.position)); estado = EstadoDaqui.borrifando; InstanciaLigando.Instantiate(particulaDoBorrifar, transform.position, 5); EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.request3dSound, SoundEffectID.Darkness4)); TempoDecorrido = 0; } break; case EstadoDaqui.esperandoMove: TempoDecorrido += Time.deltaTime; if (TempoDecorrido > TempoEsperando) { _Animator.SetTrigger("anda"); estado = EstadoDaqui.movendo; } break; case EstadoDaqui.borrifando: TempoDecorrido += Time.deltaTime; if (TempoDecorrido > TEMPO_DO_BORRIFAR_AO_DANO) { colisorDeDano.enabled = true; estado = EstadoDaqui.emEspera; new MyInvokeMethod().InvokeNoTempoDeJogo(() => { if (this != null) { _Animator.SetTrigger("retornarAoPadrao"); colisorDeDano.enabled = false; estado = EstadoDaqui.movendo; } }, .5f); } break; } PositionChangeWithAndador(); }
void RisadaPreEspecial() { if (estado == EstadoDaqui.preparandoAtkEspecial) { cont = 0; EscolhaPosAereaParaChefeChefe(); InvocaTeleportProps(true); InstanciaLigando.Instantiate(enfaseDoBoss, transform.position, 10); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestShakeCam, ShakeAxis.z, 10, 2f)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, risada)); new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, PrepararInstanciaDeEspecial, tempoDoGritoAoEspecial); } }
void Recupera() { DadosDoJogador dj = GameController.g.Manager.Dados; tempoDecorrido = 0; if (dj.PontosDeMana < dj.MaxMana) { dj.AdicionarMana(taxaDeRecuperacao); EventAgregator.Publish(new StandardSendGameEvent(EventKey.changeMagicPoints, dj.PontosDeMana, dj.MaxMana)); InstanciaLigando.Instantiate(particulaDaAcao, GameController.g.Manager.transform.position); } }
void PosTelegrafarProjetil() { _Animator.SetTrigger("retornoDoProjetil"); GameObject G = InstanciaLigando.Instantiate(particulaDeAtaque, transform.GetChild(1).position, 15); ProjetilParabolico P = G.AddComponent <ProjetilParabolico>(); Vector3 posAlvo = transform.position + 0.7f * (DirecaoNoPlano.NoUp(transform.position, doHeroi.position)) + 2 * Vector3.down; P.Iniciar(posAlvo, new Vector2(0.5f * (transform.position.x + posAlvo.x), transform.position.y + 5), particulaTelegrafista, 15 ); }
protected override void RequestAction(Vector3 charPos) { Vector3 dir = charPos - transform.position; GameObject G = InstanciaLigando.Instantiate(projetil, transform.position, 5, Quaternion.LookRotation(projetil.transform.forward, Vector3.Cross(dir, projetil.transform.forward))); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.lancaProjetilInimigo)); ProjetilInimigo P = G.AddComponent <ProjetilInimigo>(); P.Iniciar(dir, particulaTelegrafista, 10f); P.SomDeImpacto = SoundEffectID.lancaProjetilInimigo; RetornarParaEsperaZerandoTempo(); }
void ComunsDeImpactoChao() { _Animator.SetTrigger(AnimKey.tocouChao.ToString()); estado = EstadoDaqui.emEspera; new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, IniciaBoss , tempoAposTocarChao); _Animator.SetTrigger(AnimKey.tocouChaoParaPadrao.ToString()); InstanciaLigando.Instantiate(downArrowGroundParticles, transform.position + 2 * Vector3.down, 5); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.pedrasQuebrando)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestShakeCam, ShakeAxis.x, 5, 2f)); }
void AcionarSpawnaveis() { for (int i = 0; i < spawnaveis.Length; i++) { if (Vector3.Distance(GameController.g.Manager.transform.position, spawnaveis[i].transform.position) < 1) { spawnaveis[i].transform.position += 2 * Vector3.right; } InstanciaLigando.Instantiate(particulaDoInicio, spawnaveis[i].transform.position); spawnaveis[i].SetActive(true); } EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, "Fire1")); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player" && !iniciado) { if (UnicidadeDoPlayer.Verifique(collision)) { animador.SetTrigger("coletado"); InstanciaLigando.Instantiate(particulaDaColeta, transform.position); iniciado = true; EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeShiftKey, ID)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.sumContShift, KeyCont.losangulosPegos, 1)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.somParaGetLosangulo)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, "Wind1")); // Coletou(); } } }
void SpawnarMagia(Vector3 pos, Vector3 dir = default(Vector3)) { if (dir == default(Vector3)) { dir = DirecaoNoPlano.NoUpNormalizado(transform.position, HeroPosition); } GameObject G = InstanciaLigando.Instantiate(setaSombria, pos, 10); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.lancaProjetilInimigo)); G.AddComponent <ProjetilInimigo>().IniciarProjetilInimigo(dir, particulaDoTeleport, velDaMagia, SoundEffectID.lancaProjetilInimigo); G.transform.rotation = Rotation2D.GetRotation(dir); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "attackCollisor" && !GameController.g.MyKeys.VerificaAutoShift(ID)) { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.Fire1)); animador.SetTrigger("ativou"); new MyInvokeMethod().InvokeNoTempoDeJogo(() => { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.Wind1)); InstanciaLigando.Instantiate(particulaDaAcao, grade.transform.position, 5); new MyInvokeMethod().InvokeNoTempoDeJogo(() => { grade.SetActive(false); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.rockFalseAttack)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeShiftKey, ID)); }, tempoDaParticulaAaGrade); }, tempoDaAlavancaAaGrade); } }
// Update is called once per frame void Update() { if (ligado) { tempoDecorrido += Time.deltaTime; if (tempoDecorrido > intervalo) { tempoDecorrido = 0; int sorteio = Random.Range(0, barreiraSpawnavel.Length); GameObject G = InstanciaLigando.Instantiate(barreiraSpawnavel[sorteio], transform.position); spawnados.Add(G); } } List <int> indicesParaRemover = new List <int>(); for (int i = 0; i < spawnados.Count; i++) { float sinal = Mathf.Sign(transform.position.x - xDaDestruicao.position.x); if (spawnados[i] != null) { if (sinal * (spawnados[i].transform.position.x - xDaDestruicao.position.x) < 0.01f * sinal) { spawnados[i].GetComponent <ColorBarrageSemID>().DestruicaoSemID(); indicesParaRemover.Add(i); } } else { indicesParaRemover.Add(i); } } for (int i = 0; i < indicesParaRemover.Count; i++) { spawnados.RemoveAt(indicesParaRemover[indicesParaRemover.Count - 1 - i]); } }
void Borrifada() { iniciarParticulas = false; InstanciaLigando.Instantiate(particulaDaBorrifada, transform.position, 5); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.Darkness4)); new MyInvokeMethod().InvokeNoTempoDeJogo(() => { GetComponent <SpriteRenderer>().color = new Color(0.15f, 0.15f, 0.15f); colisorDeDano.enabled = true; new MyInvokeMethod().InvokeNoTempoDeJogo(() => { if (gameObject != null) { colisorDeDano.enabled = false; } }, .5f); }, tempoDoBorrifarAoDano); }
public static void OnTriggerEnterEnemyProjectile(Collider2D collision, GameObject gameObject, GameObject Particle, SoundEffectID SomDeImpacto) { Transform transform = gameObject.transform; if (collision.tag == "Player") { bool sentidoPositivo = transform.position.x - collision.transform.position.x > 0; EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.heroDamage, sentidoPositivo, 25)); } Debug.Log(collision.tag + " : " + collision.name); if (collision.tag != "Enemy" && collision.tag != "triggerGeral" && collision.tag != "attackCollisor" && collision.gameObject.layer != 12) { InstanciaLigando.Instantiate(Particle, transform.position, 2); EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.request3dSound, SomDeImpacto, 1f)); Destroy(gameObject); } }
void OnReceivedTriggerInfo(IGameEvent e) { StandardSendGameEvent ssge = (StandardSendGameEvent)e; //Debug.Log(ssge.Sender.name+" : "+estado); if (ssge.Sender.transform.IsChildOf(transform)) { Collider2D c = (Collider2D)ssge.MyObject[0]; if (ssge.Sender.name == "triggerAcionador" && estado == EstadoDaqui.emEspera && Time.time - ultimaMordida > intervaloEntreMordidas) { estado = EstadoDaqui.telegrafando; InstanciaLigando.Instantiate(particulaDoInicio, transform.position, 5); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.Fire1)); _Animator.SetTrigger("telegrafar"); new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, PosTelegrafar, tempoTelegrafando); } else if (ssge.Sender.name == "mordedorEscondido") { VerificadorDeDano(c); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player" && !iniciado) { if (UnicidadeDoPlayer.Verifique(collision)) { EventAgregator.Publish(new StandardSendGameEvent(EventKey.stopMusic)); EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.requestHeroPosition, posicionadorDoHeroi.position)); EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.requestChangeCamLimits, limitantes, changeCamLimitsTime)); EventAgregator.AddListener(EventKey.positionRequeredOk, OnHeroPositionOk); EventAgregator.AddListener(EventKey.limitCamOk, OnLimitCamOk); estado = EstadoDaqui.posicionandoHeroi_limitsCam; iniciado = true; for (int i = 0; i < barreiras.Length; i++) { barreiras[i].SetActive(true); InstanciaLigando.Instantiate(particulaDabarreira, barreiras[i].transform.position, 5); } } } }
void TelegrafaTiro() { if (gameObject != null) { Invoke("TelegrafaTiro", intervaloDeTiro); estado = EstadoDaqui.preparandoTiro; InstanciaLigando.Instantiate(particulaTelegrafista, transform.position, 5); EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.request3dSound, SoundEffectID.Wind1)); new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, () => { estado = EstadoDaqui.disparaTiro; Vector3[] dirs = new Vector3[4] { new Vector3(1, 1, 0), new Vector3(-1, 1, 0), new Vector3(1, -1, 0), new Vector3(-1, -1, 0) }; for (int i = 0; i < 4; i++) { GameObject G = InstanciaLigando.Instantiate(projetil, transform.position + distProjetilTransform * dirs[i], 5, Quaternion.LookRotation(-projetil.transform.forward, Vector3.Cross(dirs[i], -Vector3.forward)) ); ProjetilInimigo P = G.AddComponent <ProjetilInimigo>(); P.Iniciar(dirs[i], particulaTelegrafista, 10f); P.SomDeImpacto = SoundEffectID.lancaProjetilInimigo; new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, () => { estado = EstadoDaqui.padrao; }, tempoPosTiro); } }, tempoTelegrafando); } }
void OnReceivedTriggerInfo(IGameEvent e) { if (transform.IsChildOf(e.Sender.transform) && estado == EstadoDaqui.emEspera) { float px = ((Collider2D)((StandardSendGameEvent)e).MyObject[0]).transform.position.x; bool foi = false; if (Mathf.Abs(ultimoInvestimento - Time.time) > intervaloDeInvestimento) { for (int i = 0; i < trajetorias.Length; i++) { float partida = trajetorias[i].partida.position.x; float chegada = trajetorias[i].chegada.position.x; //Debug.Log(Mathf.Abs(partida - px)+" : "+px +" : "+" : "+partida+" : "+chegada+" : "+(partida < px && px < chegada) +" : "+ (partida > px && chegada < px) +" : "+ (Mathf.Abs(partida - px) > disMin)+" : "+i); if (((partida < px && px < chegada) || (partida > px && chegada < px)) && (Mathf.Abs(partida - px) > disMin)) { indiceDoDeslocamento = i; foi = true; } } if (foi) { transform.position = trajetorias[indiceDoDeslocamento].partida.position; InstanciaLigando.Instantiate(particulaDoAparecimento, transform.position, 5); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.aparicaoSurpresaDeInimigo)); estado = EstadoDaqui.telegrafando; tempoDecorrido = 0; FlipDirection.Flip(transform, trajetorias[indiceDoDeslocamento].partida.position.x - trajetorias[indiceDoDeslocamento].chegada.position.x); ChangeView(true); } } } }
public void InvocaTeleportProps(bool ligar) { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.aparicaoSurpresaDeInimigo)); InstanciaLigando.Instantiate(particulaDoTeleport, transform.position, 5); gameObject.SetActive(ligar); }
void RisadaDeApresentacao() { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, risada)); InstanciaLigando.Instantiate(enfaseDoBoss, transform.position, 10); new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, IniciarLuta, tempoDoGritoAoEspecial); }
void InstanciarSeta() { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.lancaProjetilInimigo)); InstanciaLigando.Instantiate(meuObjeto, meuObjeto.transform.position, 10); new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, PrepararInstanciaDeEspecial, tempoDoGritoAoEspecial); }
void ShowHideEnemy(bool show) { InstanciaLigando.Instantiate(particulaShowHide, transform.position, 5); meuCollider.enabled = show; arbustinhoEsconderijo.SetActive(!show); }
// Start is called before the first frame update // Update is called once per frame void Update() { if (estado != EstadoDaqui.emEspera) { tempoDecorrido += Time.deltaTime; } switch (estado) { case EstadoDaqui.spriteFinalizador: if (tempoDecorrido > TEMPO_ESCALONANDO_SPRITE) { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.Wind1)); interestObject = InstanciaLigando.Instantiate(particulasPreparaAnimaMorte, boss.position, 5); estado = EstadoDaqui.aguardandoParticulas; tempoDecorrido = 0; } else { EscalonaSprite(); } break; case EstadoDaqui.aguardandoParticulas: if (tempoDecorrido > TEMPO_AGUARDANDO_PARTICULAS) { interestObject = InstanciaLigando.Instantiate(particulasAnimaMorte, boss.position); estado = EstadoDaqui.visualizandoParticulas; tempoDecorrido = 0; AudioDoAnimaMorte(); } break; case EstadoDaqui.visualizandoParticulas: if (tempoDecorrido > TEMPO_DAS_PARTICULAS) { MonoBehaviour.Destroy(interestObject); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, dasParticulasFinalizadora)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.startSceneMusic)); InstanciaLigando.Instantiate(particulaFinalizaAnimaMorte, boss.position, 5); interestObject = InstanciaLigando.Instantiate(spriteFinalizador, boss.position); interestVector3 = interestObject.transform.localScale; meuSprite = interestObject.GetComponent <SpriteRenderer>(); premio.transform.position = boss.position; MonoBehaviour.Destroy(boss.gameObject); estado = EstadoDaqui.aguardandoPremio; tempoDecorrido = 0; } break; case EstadoDaqui.aguardandoPremio: if (tempoDecorrido < TEMPO_ESCALONANDO_SPRITE) { EscalonaSprite(); } else { EventAgregator.Publish(EventKey.requestSceneCamLimits); EventAgregator.Publish(EventKey.fechouPainelSuspenso); premio.SetActive(true); Destroy(interestObject); estado = EstadoDaqui.animaPremio; } break; } }
void AparicaoPreRisada() { gameObject.SetActive(true); InstanciaLigando.Instantiate(particulaDoTeleport, transform.position, 5); new MyInvokeMethod().InvokeNoTempoDeJogo(RisadaDeApresentacao, .5f); }