public static void Main() { var ea = new EventAgregator(); var v = new View(ea); var mv = new OnlyMouseView(ea); var ev_mouse = new MouseClick(); var ev_keyboard = new KeyboardClick(); ea.Publish <KeyboardClick>(ev_keyboard); ea.Publish <MouseClick>(ev_mouse); }
public void BotaoNao() { botaoNao(); gameObject.SetActive(false); LimpaBotoes(); EventAgregator.Publish(EventKey.negativeUiInput, null); }
void EncaixeDeEmblemaSelecionado(int qual) { if (estaNoCheckPoint) { int opcaoGuardada = qual; if (Emblema.VerificarOcupacaoDoEncaixe(dj.MeusEmblemas, opcaoGuardada).NomeId != NomesEmblemas.nulo) { Emblema E = Emblema.ListaDeEncaixados(dj.MeusEmblemas)[opcaoGuardada]; E.OnUnequip(); E.EstaEquipado = false; ReiniciarVisaoDaHud(); emblemasE.SelecionarOpcaoEspecifica(opcaoGuardada); ColocaInfoTexts(dj.MeusEmblemas[0]); numEncaixes.text = Emblema.NumeroDeEspacosOcupados(dj.MeusEmblemas) + " / " + dj.EspacosDeEmblemas; } else { EventAgregator.Publish(new StandardSendGameEvent(EventKey.triedToChangeEmblemNoSuccessfull)); GlobalController.g.UmaMensagem.ConstroiPainelUmaMensagem(OnCheckPanel, BancoDeTextos.RetornaListaDeTextoDoIdioma(ChaveDeTexto.frasesDeEmblema)[3]); } } else { EventAgregator.Publish(new StandardSendGameEvent(EventKey.triedToChangeEmblemNoSuccessfull)); EventAgregator.Publish(new SendMethodEvent(EventKey.requestInfoEmblemPanel, OnCheckPanel)); //painelDeInfoEmblema.ConstroiPainelUmaMensagem(OnCheckPanel); } }
private void OnFinalizeDefeated(IGameEvent obj) { StandardSendGameEvent ssge = (StandardSendGameEvent)obj; GameObject[] quem = new GameObject[spawnaveis.Length]; for (int i = 0; i < spawnaveis.Length; i++) { EnemyBase eny = spawnaveis[i].GetComponentInChildren <EnemyBase>(); if (eny != null) { quem[i] = eny.gameObject; } else { quem[i] = null; } if (ssge.Sender == quem[i]) { StartCoroutine(VerificaTodosSpawnadosDerrotados(quem)); new MyInvokeMethod().InvokeAoFimDoQuadro(() => { if (TodosDerrotados(quem)) { EventAgregator.Publish(EventKey.returnRememberedMusic, null); } }); } } }
protected virtual void Start() { if (ExistenciaDoController.AgendaExiste(Start, this)) { EventAgregator.Publish(new StandardSendGameEvent(EventKey.destroyShiftCheck, ID, gameObject)); } }
public bool Update() { tempoDecorrido += Time.deltaTime; switch (estado) { case EstadoDaqui.iniciando: if (tempoDecorrido > tempoParaIniciarEscalonamento) { tempoDecorrido = 0; estado = EstadoDaqui.escalonandoLosangulo; EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, somDoLosangulo)); } break; case EstadoDaqui.escalonandoLosangulo: losanguloFinalizador.SetActive(true); losanguloFinalizador.transform.localScale = Vector3.Lerp(Vector3.zero, escalaFinal, tempoDecorrido / tempoDoEscalonamentoDoRetangulo); if (tempoDecorrido > tempoDoEscalonamentoDoRetangulo) { tempoDecorrido = 0; estado = EstadoDaqui.iniciando; return(true); } break; } return(false); }
public void Toque() { switch (fase) { case FasesDaMensagem.mensagemEnchendo: EventAgregator.Publish(new StandardSendGameEvent(GameController.g.gameObject, EventKey.disparaSom, SoundEffectID.Book1.ToString())); textoDaUI.text = texto; fase = FasesDaMensagem.mensagemCheia; break; case FasesDaMensagem.mensagemCheia: EventAgregator.Publish(new StandardSendGameEvent(GameController.g.gameObject, EventKey.disparaSom, SoundEffectID.Book1.ToString())); fase = FasesDaMensagem.caixaSaindo; contadorDeTempo = 0; break; case FasesDaMensagem.caixaIndo: EventAgregator.Publish(new StandardSendGameEvent(GameController.g.gameObject, EventKey.disparaSom, SoundEffectID.Book1.ToString())); painelDaMens.anchoredPosition = posOriginal; fase = FasesDaMensagem.mensagemEnchendo; break; case FasesDaMensagem.caixaSaindo: dispara = false; fase = FasesDaMensagem.caixaSaiu; IndiceDaConversa++; break; /* * EventAgregator.Publish(new StandardSendStringEvent(GameController.g.gameObject, SoundEffectID.Book1.ToString(), EventKey.disparaSom)); * painelDaMens.anchoredPosition = new Vector2(painelDaMens.anchoredPosition.x, Screen.height); * fase = FasesDaMensagem.caixaSaiu; * break;*/ } }
protected override void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { if (UnicidadeDoPlayer.Verifique(collision)) { bool sentidoPositivo = transform.position.x - collision.transform.position.x > 0; EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.heroDamage, sentidoPositivo, Dados.AtaqueBasico)); } } if (collision.tag == "attackCollisor") { if (collision.name == "MagicAttack") { EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.enemyContactDamage, collision.name)); } else if (collision.name == "colisorDoAtaquebaixo") { EventAgregator.Publish(new StandardSendGameEvent(EventKey.colisorNoQuicavel, collision.name)); SoundOnAttack.SoundAndAnimation(transform, collision.transform.position); } else { SoundOnAttack.SoundAnimationAndRepulse(transform, forcaDeRepulsa, tempoNaRepulsao, collision.transform.position); } } }
void PosTelegrafar() { _Animator.SetTrigger("morder"); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.mordida)); estado = EstadoDaqui.mordendo; new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, PosMorder, tempoPosMordida); }
void FinalizaColeta() { particulaGeiser.Stop(); InstanciaLigando.Instantiate(particulaDaColeta, transform.position, 5); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.somParaGetLosangulo)); Destroy(gameObject); }
public override void FuncaoDoBotao() { base.FuncaoDoBotao(); EventAgregator.Publish(new StandardSendGameEvent(EventKey.getStamp, tipo)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeShiftKey, ID)); }
void PreparaAttack(bool magia, AnimKey a) { InvocaTeleportProps(true); _Animator.SetTrigger(a.ToString()); FlipDirection.Flip(transform, -(HeroPosition.x - transform.position.x)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SorteieSom(magia))); }
void PrepararInstanciaDeEspecial() { if (cont > 0) { _Animator.SetTrigger(AnimKey.sairDaMagia.ToString()); } if (estado == EstadoDaqui.preparandoAtkEspecial && cont < totalDeEspeciaisPorAcionamento) { cont++; SelecioneUmEspecial(); for (int i = 0; i < meuObjeto.transform.childCount; i++) { Vector3 V = meuObjeto.transform.GetChild(i).position; InstanciaLigando.Instantiate(particulaTelegrafistaDoProjetil, V, 5); } _Animator.SetTrigger(AnimKey.magia.ToString()); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestShakeCam, ShakeAxis.z, 5, 1f)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SorteieSom(true))); new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, InstanciarSeta, tempoTelegrafandoEspecial); } else if (cont >= totalDeEspeciaisPorAcionamento) { estado = EstadoDaqui.emEspera; IniciaBoss(); } }
public void StartApplyJump() { lastGroundedY = transform.position.y; features.isJumping = true; controle.Move(Vector3.up * features.initialImpulse); EventAgregator.Publish(new GameEvent(EventKey.animateStartJump, controle.gameObject)); }
private void OnAnimationPointReceive(IGameEvent obj) { Debug.Log(obj.Sender); if (obj.Sender == gameObject) { StandardSendGameEvent ssge = (StandardSendGameEvent)obj; string animationName = (string)ssge.MyObject[0]; Debug.Log("animation POint: " + (string)ssge.MyObject[0]); if (animationName == "strongerEnemyMagicAttack") { string receivedInfo = (string)ssge.MyObject[1]; GameObject G = InstanciaLigando.Instantiate(projetil, projetilOrigim.position, 5, Quaternion.LookRotation(-Vector3.forward) ); G.AddComponent <ProjetilInimigo>().IniciarProjetilInimigo(Vector3.right, particulaTelegrafista, 15, SoundEffectID.lancaProjetilInimigo); G = InstanciaLigando.Instantiate(projetil, projetilOrigim.position, 5); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.lancaProjetilInimigo)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestShakeCam, ShakeAxis.z, 3, 2f)); G.AddComponent <ProjetilInimigo>().IniciarProjetilInimigo(-Vector3.right, particulaTelegrafista, 15, SoundEffectID.lancaProjetilInimigo); } else if (animationName == "ataqueBasicoStrongerArea1_Enemy" || animationName == "padraoStrongerArea1_Enemy") { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.EnemySlash)); } } }
private void Update() { switch (estado) { case EstadoDaqui.spriteFinalizador: if (spriteFinBoss.Update()) { boss.InvocaTeleportProps(false); new MyInvokeMethod().InvokeNoTempoDeJogo(AparecendoDoTeleport, .75f); estado = EstadoDaqui.emEspera; } break; case EstadoDaqui.falaFinal: if (npc.Update()) { boss.InvocaTeleportProps(false); avatar.SetActive(false); new MyInvokeMethod().InvokeNoTempoDeJogo(ParticulaPosSumico, tempoPosSumico); EventAgregator.Publish(EventKey.abriuPainelSuspenso); estado = EstadoDaqui.emEspera; } break; } }
void VerifiqueInvestida() { if (Time.time - ultimaInvestida > INTERVALO_DE_INVESTIMENTOS && Vector3.Distance(GameController.g.Manager.transform.position, transform.position) < DISTANCIA_DO_INVESTIMENTO) { RaycastHit2D hit = Physics2D.Linecast(transform.position, GameController.g.Manager.transform.position, 511); if (!hit) { ultimaInvestida = Time.time; _Animator.SetTrigger("preparaInvestida"); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.Wind1)); estado = EstadoDaqui.preparandoInvestida; dirGuardada = GameController.g.Manager.transform.position - transform.position; dirGuardada.Normalize(); qAlvo = Quaternion.LookRotation(Vector3.forward, Vector3.Cross(dirGuardada, Vector3.forward)); FlipDirection.Flip(transform, dirDeMovimento.x); new MyInvokeMethod().InvokeNoTempoDeJogo(gameObject, () => { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, impulso)); dirGuardada = GameController.g.Manager.transform.position - transform.position; dirGuardada.Normalize(); dirGuardada *= VEL_DA_INVESTIDA; transform.rotation = Quaternion.LookRotation(Vector3.forward, Vector3.Cross(dirGuardada, Vector3.forward)); estado = EstadoDaqui.investindo; }, TEMPO_PREPARANDO); } } }
void OpcaoEscolhida(int indice) { BancoDeTextos.linguaChave = languageMenu.IdiomaNoIndice(indice); //bandeirinha.sprite = languageMenu.BandeirinhaNoIndice(indice); languageMenu.FinalizarHud(); //BtnsManager.ReligarBotoes(gameObject); InterfaceLanguageConverter[] ilc = MonoBehaviour.FindObjectsOfType <InterfaceLanguageConverter>(); foreach (InterfaceLanguageConverter I in ilc) { I.MudaTexto(); } SaveDatesManager.s.ChosenLanguage = BancoDeTextos.linguaChave; SaveDatesManager.Save(); EventAgregator.Publish(EventKey.returnToMainMenu, null); /* * InitialSceneManager.i.EstadoDeEscolhaInicial(); * InitialSceneManager.i.AtualizaLista();*/ estado = EstadosDoSwitch.emEspera; }
public void ChangeSwirdColor(int cor) { Color C = Color.white; CorDeEspadaSelecionada = cor; switch (cor) { case 0: C = Color.white; break; case 1: C = Color.blue; break; case 2: C = Color.green; break; case 3: C = new Color(0.68f, 0.75f, 0); break; case 4: C = Color.red; break; } colisorDoAtaqueComum.GetComponent <SpriteRenderer>().color = C; colisorDoAtaquePrabaixo.GetComponent <SpriteRenderer>().color = C; colisorDoAtaquePraCima.GetComponent <SpriteRenderer>().color = C; EventAgregator.Publish(new StandardSendGameEvent(null, EventKey.colorChanged, cor)); }
public void BtnVoltar() { EssaLoja.FinalizarHud(); estado = EstadoDaqui.emEspera; EventAgregator.Publish(EventKey.fechouPainelSuspenso); EventAgregator.Publish(EventKey.requestShowControllers, null); }
protected override void OnTriggerEnter2D(Collider2D collision) { Vector3 posHeroi = GameController.g.Manager.transform.position; if (collision.tag == "Player" || collision.gameObject.name == "MagicAttack" || estado == EstadoDaqui.emAtaque || //(collision.gameObject.name == "colisorDeAtaqueComum" (Mathf.Sign(posHeroi.x - transform.position.x) == Mathf.Sign(transform.localScale.x))) { base.OnTriggerEnter2D(collision); } else if (Mathf.Sign(posHeroi.x - transform.position.x) != Mathf.Sign(transform.localScale.x)) { if (collision.gameObject.name == "colisorDoAtaquebaixo") { SoundOnAttack.SoundAndAnimation(transform, collision.transform.position); EventAgregator.Publish(new StandardSendGameEvent(EventKey.colisorNoQuicavel, collision.name)); } else if (collision.tag == "attackCollisor") { SoundOnAttack.SoundAnimationAndRepulse(transform, forcaDeRepulsa, tempoNaRepulsao, collision.transform.position); } // EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestCharRepulse, forcaDeRepulsa * Mathf.Sign(-transform.localScale.x) * Vector3.right, tempoNaRepulsao)); //EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.rockFalseAttack)); } }
// Update is called once per frame void Update() { #region changeController Controlador antigo = control; if (Input.touchCount > 0) { control = Controlador.Android; } if (Input.GetKeyDown(KeyCode.BackQuote) || Input.GetKeyDown(KeyCode.Space)) { control = Controlador.teclado; } if (Input.GetKeyDown(KeyCode.Joystick1Button0)) { control = Controlador.joystick1; } if (antigo != control) { EventAgregator.Publish(new StandardSendGameEvent(EventKey.changeHardwareController, control)); } #endregion musica.Update(); }
private void OnTriggerEnter2D(Collider2D collision) { KeyVar myKeys = GameController.g.MyKeys; if (collision.tag == "attackCollisor") { Debug.Log(myKeys.VerificaAutoCont(ID) + " os hits"); myKeys.SomaAutoCont(ID, 1); int moedasAgora; bool foi = myKeys.VerificaAutoCont(ID) < numHits; moedasAgora = numMoedas / (numHits + 1); if (!foi) { moedasAgora = numMoedas - (numHits - 1) * moedasAgora; } SpawnMoedas.Spawn(transform.position, moedasAgora); new MyInvokeMethod().InvokeNoTempoDeJogo(() => { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, "Break")); }, .3f); if (!foi) { myKeys.MudaAutoShift(ID, true); particulaDaFinalizacao.SetActive(true); Destroy(GetComponent <Collider2D>()); Destroy(GetComponent <SpriteRenderer>()); Destroy(gameObject, 5); } } }
public override void FuncaoDoBotao() { Time.timeScale = 0; EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeShiftKey, ID)); EventAgregator.Publish(EventKey.abriuPainelSuspenso, null); EventAgregator.Publish(new StandardSendGameEvent(EventKey.getEmblem, nome)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.painelAbrindo)); EventAgregator.Publish(EventKey.stopMusic, null); new MyInvokeMethod().InvokeNoTempoReal( () => { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.vinhetinhaDoSite)); }, .5f ); GetComponent <SpriteRenderer>().enabled = false; Destroy(GetComponent <Collider2D>()); int idDoEmblema = (int)nome; painelEmblema.ConstroiPainelUmaMensagem(DeuOkNoPainel, BancoDeTextos.RetornaListaDeTextoDoIdioma(ChaveDeTexto.emblemasTitle)[idDoEmblema]); descricaoDoEmblema.text = BancoDeTextos.RetornaListaDeTextoDoIdioma(ChaveDeTexto.emblemasInfo)[idDoEmblema]; Texture2D t2d = (Texture2D)Resources.Load(nome.ToString()); Sprite S = Sprite.Create(t2d, new Rect(0, 0, t2d.width, t2d.height), t2d.texelSize); imgDoEmblema.sprite = S; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player" && !jaIniciaou) { if (UnicidadeDoPlayer.Verifique(collision)) { jaIniciaou = true; for (int i = 0; i < barreiras.Length; i++) { InstanciaLigando.Instantiate(particulaDoInicio, barreiras[i].transform.position, 5); barreiras[i].SetActive(true); } EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeCamLimits, limitantes, 3f)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.pedrasQuebrando)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.changeMusicWithRecovery, new NameMusicaComVolumeConfig() { Musica = NameMusic.trapMusic, Volume = 1 })); } } }
// Start is called before the first frame update public void Start(float move, bool chao) { Vector3 S; if (move < 0) { S = particulaDoInicio.transform.localScale; S.x = -Mathf.Abs(S.x); particulaDoInicio.transform.localScale = S; S = particulaDoMovomento.transform.localScale; S.x = -Mathf.Abs(S.x); particulaDoMovomento.transform.localScale = S; } else { S = particulaDoInicio.transform.localScale; S.x = Mathf.Abs(S.x); particulaDoInicio.transform.localScale = S; S = particulaDoMovomento.transform.localScale; S.x = Mathf.Abs(S.x); particulaDoMovomento.transform.localScale = S; } particulaDoInicio.gameObject.SetActive(true); particulaDoInicio.Play(); particulaDoMovomento.gameObject.SetActive(true); tempoDecorrido = 0; esteveNochao = chao; EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, somDoDash)); }
static IEnumerator FillDates() { yield return(new WaitForEndOfFrame()); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestToFillDates, SaveDatesManager.s.CurrentSaveDate)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.checkPointLoad)); }
// Update is called once per frame void Update() { switch (estado) { case EstadoDaqui.investindo: tempoDecorrido += Time.deltaTime; Vector3 partida = trajetorias[indiceDoDeslocamento].partida.position; Vector3 chegada = trajetorias[indiceDoDeslocamento].chegada.position; float dist = Vector3.Distance(partida, chegada); transform.position = Vector3.Lerp(partida, chegada, tempoDecorrido * vel / dist); if (tempoDecorrido * vel / dist > 1) { estado = EstadoDaqui.emEspera; ultimoInvestimento = Time.time; InstanciaLigando.Instantiate(particulaDoAparecimento, transform.position, 5); EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.request3dSound, SoundEffectID.aparicaoSurpresaDeInimigo)); particulaDoDeslocamento.SetActive(false); ChangeView(false); } break; case EstadoDaqui.telegrafando: tempoDecorrido += Time.deltaTime; if (tempoDecorrido > tempoTelegrafando) { tempoDecorrido = 0; estado = EstadoDaqui.investindo; particulaDoDeslocamento.SetActive(true); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.avancoDoInimigo)); } break; } }
public void BtnCancelar() { estado = EstadoDaqui.emEspera; menu.FinalizarHud(); menuContainer.SetActive(false); EventAgregator.Publish(EventKey.fechouPainelSuspenso); }
private void OnTriggerEnter2D(Collider2D collision) { KeyVar kv = GameController.g.MyKeys; if (collision.tag == "attackCollisor" && !kv.VerificaEnemyShift(ID)) { //kv.SomaAutoCont(ID, 1); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, som)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.sumContShift, ID, 1)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeEnemyKey, "limparContPentagono" + ID)); if (kv.VerificaAutoCont(ID) >= contCargasTotais) { EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeEnemyKey, ID)); Desativar(); new MyInvokeMethod().InvokeNoTempoDeJogo(() => { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.exitCheckPoint)); }, .5f); } InstanciaLigando.Instantiate(particulaDeAcao, 0.5f * (collision.transform.position + transform.position), 5); DadosDoJogador dj = GameController.g.Manager.Dados; if (dj.PontosDeMana < dj.MaxMana) { dj.AdicionarMana(taxaDeRecuperacao); EventAgregator.Publish(new StandardSendGameEvent(EventKey.changeMagicPoints, dj.PontosDeMana, dj.MaxMana)); } } }