protected virtual void FinalizaConversa() { estado = EstadoDoNPC.finalizadoComBotao; //meuTransform.rotation = Quaternion.LookRotation(-Vector3.forward); EventAgregator.Publish(new StandardSendGameEvent(EventKey.finalizaDisparaTexto)); /* * GameController.g.HudM.ligarControladores(); * GameController.g.HudM.Botaozao.FinalizarBotao(); * GameController.g.HudM.DisparaT.DesligarPaineis(); * * * AndroidController.a.LigarControlador(); */ }
public virtual void IniciarHud() { TitleUpdate.transform.parent.gameObject.SetActive(true); int quantidade = SetarOpcoes(); if (quantidade > 0) { IniciarHUD(quantidade, TipoDeRedimensionamento.vertical); } else { itemDoContainer.SetActive(false); } EventAgregator.AddListener(EventKey.UiDeOpcoesChange, OnChangeOption); }
void Coletou() { Time.timeScale = 0; painel.ConstroiPainelUmaMensagem(OnCloseFirstPanel); EventAgregator.Publish(new StandardSendGameEvent(EventKey.getColorSword, SwordColor.blue)); EventAgregator.Publish(EventKey.abriuPainelSuspenso, null); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeShiftKey, KeyShift.venceuCirculoImperfeito)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.painelAbrindo)); // EventAgregator.Publish(ePentagono ? EventKey.getPentagon : EventKey.getHexagon, null); GetComponent <SpriteRenderer>().enabled = false; Destroy(GetComponent <Collider2D>()); }
public virtual void IniciaConversa() { // siga.PareAgora(); EventAgregator.Publish(new StandardSendGameEvent(EventKey.inicializaDisparaTexto)); GameController.g.DisparaT.IniciarDisparadorDeTextos(); GameController.g.DisparaT.IndiceDaConversa = modificarIndiceDeInicio; /* * GameController.g.HudM.DisparaT.IniciarDisparadorDeTextos(); * GameController.g.HudM.DisparaT.IndiceDaConversa = modificarIndiceDeInicio; * GameController.g.HudM.Botaozao.IniciarBotao(FinalizaConversa, * BancoDeTextos.RetornaFraseDoIdioma(ChaveDeTexto.ObrigadoComPressa) * );*/ estado = EstadoDoNPC.conversando; }
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")); }
public override void OnConnectedToMaster() { if (connState == ConnectionState.conectandoComoMaster) { string s = System.Guid.NewGuid().ToString(); EventAgregator.Publish(new GameEvent(EventKey.conexaoRealizada, s)); PhotonNetwork.CreateRoom(s); } else if (connState == ConnectionState.conectandoParaJoin) { PhotonNetwork.JoinLobby(); EventAgregator.Publish(new GameEvent(EventKey.entrandoNoLobby)); } }
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 OnReceiveAnimationPoint(IGameEvent e) { StandardSendGameEvent ssge = (StandardSendGameEvent)e; if (e.Sender == gameObject && (string)ssge.MyObject[1] != "secondSound") { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.somParaEruptLosangulo)); particulaGeiser.gameObject.SetActive(true); Invoke("FinalizaColeta", 2); } else if (e.Sender == gameObject && (string)ssge.MyObject[1] == "secondSound") { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, "Wind1")); } }
private static void OnActiveSceneChanged(Scene arg0, Scene arg1) { SceneManager.activeSceneChanged -= OnActiveSceneChanged; Time.timeScale = 1; GameController.g.Manager.transform.position = posAlvo; GameController.g.VerifiqueDinheiroCaido(GameController.g.Manager.Dados.DinheiroCaido); GlobalController.g.FadeV.IniciarFadeInComAction(OnFadeInComplete); MonoBehaviour.FindObjectOfType <Camera2D>().AposMudarDeCena(posAlvo + new Vector3(0, 0, -10)); EventAgregator.Publish(EventKey.changeActiveScene, null); new MyInvokeMethod().InvokeAoFimDoQuadro(() => { EventAgregator.Publish(EventKey.localNameExibition); }); }
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)); }
private void OnDestroy() { EventAgregator.RemoveListener(EventKey.requestHideControllers, OnRequestHideControlls); EventAgregator.RemoveListener(EventKey.requestShowControllers, OnRequestShowControlls); EventAgregator.RemoveListener(EventKey.changeHardwareController, OnChangeHardwareController); #region EventosEspecificosDoJogo_Destroy /* Eventos especificos do jogo */ //FayvitCommandReaderEventAgregator.RemoveListener(EventKey.inicializaDisparaTexto, OnStartTalk); //FayvitCommandReaderEventAgregator.RemoveListener(EventKey.finalizaDisparaTexto, OnFinishTalk); //FayvitCommandReaderEventAgregator.RemoveListener(EventKey.startCheckPoint, OnStartCheckPoint); //FayvitCommandReaderEventAgregator.RemoveListener(EventKey.requestToFillDates, OnRequestFillDates); //FayvitCommandReaderEventAgregator.RemoveListener(EventKey.starterHudForTest, VerifiqueBtnDash); //FayvitCommandReaderEventAgregator.RemoveListener(EventKey.allAbilityOn, VerifiqueBtnDash); #endregion }
public void IniciarMenuDePause() { if (GameController.g.Manager.Estado != EstadoDePersonagem.derrotado) { Time.timeScale = 0; estadoAoPausar = GameController.g.Manager.Estado; EventAgregator.Publish(new StandardSendGameEvent(EventKey.enterPause)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestHideControllers)); containerDoMenuDePause.SetActive(true); IniciarQualMenu(qualMenu); EventAgregator.AddListener(EventKey.returnToMainMenu, OnReturnToMainMenu); EventAgregator.AddListener(EventKey.triedToChangeEmblemNoSuccessfull, OnTriedEmblem); EventAgregator.AddListener(EventKey.requestReturnToEmblemMenu, OnRequestEmblemMenu); } }
public void Auth() { _eventAgregator = new EventAgregator(); _eventQueue = new Queue <string>(); _ws = new WebSocket(Address); _ws.OnMessage += OnMessage; _ws.OnOpen += OnConnectionOpen; _ws.OnClose += OnConnectionClose; _ws.OnError += OnConnectionError; if (!GameLayer.I.EmulateServer) { _ws.Connect(); } }
// Update is called once per frame void Update() { if (escurecer) { IniciarFadeOut(); escurecer = false; } if (clarear) { IniciarFadeIn(); clarear = false; } switch (fase) { case FaseDaqui.escurecendo: tempoDecorrido += Time.fixedDeltaTime; corDoFade.a = tempoDecorrido / tempoDeEscurecimento; escurecedorUpper.color = corDoFade; escurecedorLower.color = corDoFade; if (tempoDecorrido > tempoDeEscurecimento) { fase = FaseDaqui.emEspera; ChamarAcao(); EventAgregator.Publish(EventKey.fadeOutComplete, null); } break; case FaseDaqui.clareando: tempoDecorrido += Time.fixedDeltaTime; corDoFade.a = (tempoDeEscurecimento - tempoDecorrido) / tempoDeEscurecimento; escurecedorUpper.color = corDoFade; escurecedorLower.color = escurecedorUpper.color; if (tempoDecorrido > tempoDeEscurecimento) { fase = FaseDaqui.emEspera; EventAgregator.Publish(EventKey.fadeInComplete, null); ChamarAcao(); escurecedorLower.gameObject.SetActive(false); escurecedorUpper.gameObject.SetActive(false); } break; } }
void VerifiqueConfirmacao(GameObject qual) { CofreDosLosangulos c = null; for (int i = 0; i < cofres.Length; i++) { if (qual == cofres[i].gameObject) { Debug.Log("indice do cofre é: " + i); c = cofres[i]; } } KeyVar myKeys = GameController.g.MyKeys; int sum = 0; for (int i = myKeys.VerificaCont(KeyCont.losangulosConfirmados); i < myKeys.VerificaCont(KeyCont.losangulosPegos); i++) { if (i >= c.InicioDeAcao - 1 && i < c.FinalDeAcao) { SouUmLosanguloGerenciavel s = transform.GetChild(i).GetComponent <SouUmLosanguloGerenciavel>(); s.MySprite.sprite = spriteAmarelo; Debug.Log("filho " + i + " :" + s.name); GameObject G = Instantiate(particulaDaConfirmacao, s.transform.position, Quaternion.identity); G.SetActive(true); Destroy(G, 5); SpawnMoedas.Spawn(s.transform.position, Mathf.Max(5, i)); sum++; } } if (sum > 0) { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.somParaGetLosangulo)); new MyInvokeMethod().InvokeNoTempoDeJogo(() => { EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.VariasMoedas)); }, .35f); } myKeys.SomaCont(KeyCont.losangulosConfirmados, sum); Debug.Log(myKeys.VerificaCont(KeyCont.losangulosConfirmados) + " confirmados"); }
void FinalizarMenuDepause() { estado = EstadoDaqui.emEspera; FinalizarTodasAsAbas(); Time.timeScale = 1; containerDoMenuDePause.SetActive(false); mapPanel.OnUnpausedGame(); EventAgregator.Publish(new StandardSendGameEvent(EventKey.exitPause, estadoAoPausar)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestShowControllers)); EventAgregator.RemoveListener(EventKey.returnToMainMenu, OnReturnToMainMenu); EventAgregator.RemoveListener(EventKey.triedToChangeEmblemNoSuccessfull, OnTriedEmblem); EventAgregator.RemoveListener(EventKey.requestReturnToEmblemMenu, OnRequestEmblemMenu); }
void OnReceivedTrigerInfo(IGameEvent e) { StandardSendGameEvent ssge = (StandardSendGameEvent)e; Collider2D collision = (Collider2D)ssge.MyObject[0]; if (ssge.Sender.transform.IsChildOf(transform) && collision.tag == "Player" && colisorDeDano.enabled) { 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, 25)); } } } }
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); }
// Update is called once per frame public void Update() { switch (estado) { case EstadosDoSwitch.menuSuspenso: languageMenu.MudarOpcao(); if (ActionManager.ButtonUp(0, GlobalController.g.Control)) { EventAgregator.Publish(EventKey.positiveUiInput, null); OpcaoEscolhida(languageMenu.OpcaoEscolhida); estado = EstadosDoSwitch.emEspera; } break; } }
protected override void OnTriggerEnter2D(Collider2D collision) { Vector3 posHeroi = GameController.g.Manager.transform.position; if (collision.gameObject.name != "colisorDeAtaqueComum" || (estado != EstadoDaqui.movendo && estado != EstadoDaqui.esperandoMove) || (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)) { EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestCharRepulse, forcaDeRepulsa * Mathf.Sign(-transform.localScale.x) * Vector3.right, tempoNaRepulsao)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.rockFalseAttack)); } }
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(); } } }
private void OnHeroDamage(IGameEvent obj) { StandardSendGameEvent ssge = (StandardSendGameEvent)obj; if ((!piscaI.Invuneravel || ssge.MyObject.Length > 2) && Dados.PontosDeVida > 0) { Dados.AplicaDano((int)ssge.MyObject[1]); EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.changeLifePoints, Dados.PontosDeVida, Dados.MaxVida)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestShakeCam, ShakeAxis.y, 3, 1f)); RetornarComponentesAoPAdrao(); emDano.Start(transform.position, new Vector3((bool)ssge.MyObject[0] ? -1 : 1, 1, 0)); if (dados.PontosDeVida > 0) { if (GameController.g.MyKeys.VerificaAutoShift("equiped_" + NomesEmblemas.suspiroLongo)) { piscaI.Start(2); } else { piscaI.Start(1); } estado = EstadoDePersonagem.emDano; EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, somDoDano)); if (ssge.MyObject.Length > 2) { tDamage.agendado = true; tDamage.pos = (Vector3)ssge.MyObject[2]; } } else { InvokeDerrota(ssge.Sender.transform.position); } Destroy( Instantiate(heroParticleDamage, transform.position, Quaternion.identity), 5); } else if (dados.PontosDeVida <= 0 && estado != EstadoDePersonagem.derrotado) { InvokeDerrota(ssge.Sender.transform.position); } }
void OnCloseFirstPanel() { particulaDaAcao.SetActive(true); if ((GameController.g.Manager.Dados.PartesDeHexagonoObtidas < 6 && !ePentagono) || (GameController.g.Manager.Dados.PartesDePentagonosObtidas < 5 && ePentagono)) { GameController.g.StartCoroutine(PainelAoFimDoQuadro()); } else { particulaDaGeometriaCompleto.SetActive(true); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.Fire3)); new MyInvokeMethod().InvokeNoTempoReal(FinalDaCompletude, tempoDaParticulaDeCompletude); new MyInvokeMethod().InvokeNoTempoReal(SomDaAcaoDeUpdate, .25f); } }
public static void OnBuy(NomeMercadoria n, int quantidade = 1) { switch (n) { case NomeMercadoria.anelDeIntegridade: case NomeMercadoria.CQD: EventAgregator.Publish(new StandardSendGameEvent(EventKey.getItem, MercadoriaToItem(n), quantidade)); break; case NomeMercadoria.dinheiroMagnetico: case NomeMercadoria.suspiroLongo: EventAgregator.Publish(new StandardSendGameEvent(EventKey.getEmblem, MercadoriaToEmblema(n))); break; case NomeMercadoria.fragmentoDeHexagono: case NomeMercadoria.fragmentoDePentagono: new MyInvokeMethod().InvokeAoFimDoQuadro(() => { EventAgregator.Publish(new StandardSendGameEvent(EventKey.buyUpdateGeometry, n == NomeMercadoria.fragmentoDePentagono)); }); break; case NomeMercadoria.escadaParaProfundezas: EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeShiftKey, KeyShift.escadaDasProfundezas)); break; case NomeMercadoria.SeloPositivistaDoAmor: EventAgregator.Publish(new StandardSendGameEvent(EventKey.getStamp, MercadoriaToSeloPositivistas(n))); break; } switch (n) { case NomeMercadoria.anelDeIntegridade: case NomeMercadoria.CQD: case NomeMercadoria.dinheiroMagnetico: case NomeMercadoria.suspiroLongo: case NomeMercadoria.escadaParaProfundezas: case NomeMercadoria.SeloPositivistaDoAmor: new MyInvokeMethod().InvokeAoFimDoQuadro(() => { EventAgregator.Publish(EventKey.compraConcluida); }); break; } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { if (UnicidadeDoPlayer.Verifique(collision)) { EventAgregator.Publish(new StandardSendGameEvent(EventKey.getCoinBag)); particulaDaPegada.SetActive(true); Destroy( Instantiate(particulaDaPegada, transform.position, Quaternion.identity), 5); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.VariasMoedas)); Destroy(gameObject); } } }
// Start is called before the first frame update void Start() { if (ExistenciaDoController.AgendaExiste(Start, this)) { EventAgregator.Publish(new StandardSendGameEvent(EventKey.destroyShiftCheck, ID, gameObject)); } if (myCollider == null) { myCollider = GetComponent <TilemapCollider2D>(); } if (myTile == null) { myTile = GetComponent <Tilemap>(); } }
private void Update() { if (iniciarRotacao) { tempoDecorrido += Time.deltaTime; transform.rotation = Quaternion.Euler(0, 0, Mathf.Lerp(0, rotTarget, tempoDecorrido / tempoDaRotacao)); if (tempoDecorrido > tempoDaRotacao) { transform.rotation = Quaternion.Euler(0, 0, rotTarget); EventAgregator.Publish(EventKey.requestSceneCamLimits); EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeShiftKey, ID)); EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.pedrasQuebrando)); enabled = false; } } }
private void Start() { if (cj == null) { cj = this; } else { Destroy(gameObject); } if (GetComponent <Image>() == null) { Debug.LogError("There is no joystick image attached to this script."); } if (transform.GetChild(0).GetComponent <Image>() == null) { Debug.LogError("There is no joystick handle image attached to this script."); } if (GetComponent <Image>() != null && transform.GetChild(0).GetComponent <Image>() != null) { bgImage = GetComponent <Image>(); joystickKnobImage = transform.GetChild(0).GetComponent <Image>(); bgImage.rectTransform.GetWorldCorners(fourCornersArray); bgImageStartPosition = fourCornersArray[3]; bgImage.rectTransform.pivot = new Vector2(1, 0); bgImage.rectTransform.anchorMin = new Vector2(0, 0); bgImage.rectTransform.anchorMax = new Vector2(0, 0); bgImage.rectTransform.position = bgImageStartPosition; } EventAgregator.AddListener(EventKey.inicializaDisparaTexto, OnStartTalk); EventAgregator.AddListener(EventKey.finalizaDisparaTexto, OnFinishTalk); EventAgregator.AddListener(EventKey.requestHideControllers, OnStartTalk); EventAgregator.AddListener(EventKey.requestShowControllers, OnFinishTalk); EventAgregator.AddListener(EventKey.startCheckPoint, OnStartCheckPoint); EventAgregator.AddListener(EventKey.requestToFillDates, OnRequestFillDates); EventAgregator.AddListener(EventKey.starterHudForTest, VerifiqueBtnDash); EventAgregator.AddListener(EventKey.allAbilityOn, VerifiqueBtnDash); }
void VerifiqueLimiteLerp() { if (pedindoLimiteLerp) { tempoDecorrido += Time.deltaTime; limitantes.xMax = Mathf.Lerp(lerpLimitantesTransitorio.xMax, lerpLimitantes.xMax, tempoDecorrido / tempoDeLerpLimits); limitantes.xMin = Mathf.Lerp(lerpLimitantesTransitorio.xMin, lerpLimitantes.xMin, tempoDecorrido / tempoDeLerpLimits); limitantes.yMax = Mathf.Lerp(lerpLimitantesTransitorio.yMax, lerpLimitantes.yMax, tempoDecorrido / tempoDeLerpLimits); limitantes.yMin = Mathf.Lerp(lerpLimitantesTransitorio.yMin, lerpLimitantes.yMin, tempoDecorrido / tempoDeLerpLimits); if (tempoDecorrido > tempoDeLerpLimits) { pedindoLimiteLerp = false; EventAgregator.Publish(new StandardSendGameEvent(EventKey.limitCamOk, limitantes)); } } }
private void OnTriggerEnter2D(Collider2D collision) { //Debug.Log(collision.name + " : " + collision.tag); 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" && gameObject.layer == 11) { EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.enemyContactDamage, collision.name)); } }