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)); } }
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); } } }
protected override void OnTriggerEnter2D(Collider2D collision) { base.OnTriggerEnter2D(collision); if (collision.tag == "attackCollisor") { EventAgregator.Publish(new StandardSendGameEvent(EventKey.colisorNoQuicavel, collision.name)); SoundOnAttack.SoundAndAnimation(transform, collision.transform.position); } }