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);
            }
        }
    }
Beispiel #2
0
    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
                }));
            }
        }
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        KeyVar myKeys = GameController.g.MyKeys;

        if (collision.tag == "Player")
        {
            if (myKeys.VerificaCont(KeyCont.losangulosPegos) >= InicioDeAcao
                &&
                myKeys.VerificaCont(KeyCont.losangulosConfirmados) < FinalDeAcao
                &&
                myKeys.VerificaCont(KeyCont.losangulosPegos) > myKeys.VerificaCont(KeyCont.losangulosConfirmados))
            {
                if (UnicidadeDoPlayer.Verifique(collision))
                {
                    EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.cofreRequisitado));

                    if (myKeys.VerificaCont(KeyCont.losangulosPegos) >= FinalDeAcao)
                    {
                        new MyInvokeMethod().InvokeNoTempoDeJogo(() =>
                        {
                            premio.SetActive(true);
                            GetComponent <SpriteRenderer>().sprite = spriteAberto;
                            Destroy(Instantiate(LosanguloManager.l.ParticulaPoeira, transform.position, Quaternion.identity), 5);

                            EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.rockFalseAttack));

                            TrophiesManager.VerifyTrophy(TrophyId.abraUmCofre);
                        }, 1);
                    }
                }
            }
        }
    }
Beispiel #4
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         if (UnicidadeDoPlayer.Verifique(collision))
         {
             ativo = false;
         }
     }
 }
Beispiel #5
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         if (UnicidadeDoPlayer.Verifique(collision))
         {
             GlobalController.g.FadeV.IniciarFadeOutComAction(OnFadeOutComplete, 0.5f);
         }
     }
 }
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         if (UnicidadeDoPlayer.Verifique(collision))
         {
             EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.triggerInfo, collision));
         }
     }
 }
Beispiel #7
0
 protected virtual 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, 25, teleportPosition));
         }
     }
 }
Beispiel #8
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         if (UnicidadeDoPlayer.Verifique(collision))
         {
             Debug.Log("ativou");
             ativo = true;
         }
     }
 }
Beispiel #9
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player" && !GameController.g.MyKeys.VerificaAutoShift(ID))
     {
         if (UnicidadeDoPlayer.Verifique(collision))
         {
             GameController.g.LocalName.RequestLocalNameExibition(
                 BancoDeTextos.RetornaListaDeTextoDoIdioma(ChaveDeTexto.nomesParaCenarios)[(int)localName], sempreDiscreto);
             EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeShiftKey, ID));
         }
     }
 }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            if (UnicidadeDoPlayer.Verifique(collision))
            {
                GlobalController.g.FadeV.IniciarFadeOutComAction(OnFadeOutComplete, 0.5f);

                restritor.VerifiqueLimitantesParaMudeCena(cenasAlvo[0]);
            }
        }
    }
 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, valorDeDano));
         }
     }
 }
Beispiel #12
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (podeSpawnarParticula && collision.tag == "Player")
        {
            if (UnicidadeDoPlayer.Verifique(collision))
            {
                podeSpawnarParticula = false;
                Destroy(Instantiate(particula, collision.transform.position, Quaternion.identity), 5);

                new MyInvokeMethod().InvokeNoTempoDeJogo(() => { podeSpawnarParticula = true; }, intervaloEntreSpawnParticulas);

                EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, s, .5f));
            }
        }
    }
Beispiel #13
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            if (UnicidadeDoPlayer.Verifique(collision))
            {
                if (cenaDosLimitantes != NomesCenas.nula)
                {
                    limitantes = GlobalController.g.SceneDates.GetSceneDates(cenaDosLimitantes).limitantes;
                }

                SceneManager.activeSceneChanged += ModifiqueLimitantesAct;
                SceneManager.sceneLoaded        += ModifiqueLimitantes;
            }
        }
    }
 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();
         }
     }
 }
Beispiel #15
0
    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));
                }
            }
        }
    }
    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);
            }
        }
    }
Beispiel #17
0
    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));
        }
    }
    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);
                }
            }
        }
    }