Exemplo n.º 1
0
    private void OnEnemyContactDamage(IGameEvent obj)
    {
        StandardSendGameEvent ssge = (StandardSendGameEvent)obj;

        if ((string)ssge.MyObject[0] == "MagicAttack")
        {
            EventAgregator.Publish(new StandardSendGameEvent(obj.Sender, EventKey.sendDamageForEnemy, Dados.AtaqueMagico));
        }
        else
        {
            EventAgregator.Publish(new StandardSendGameEvent(obj.Sender, EventKey.sendDamageForEnemy, Dados.AtaqueBasico));
            EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestShakeCam, ShakeAxis.z, 2, 1f));

            Dados.AdicionarMana(1);
            EventAgregator.Publish(new StandardSendGameEvent(gameObject, EventKey.changeMagicPoints, Dados.PontosDeMana, Dados.MaxMana));
        }

        if ((string)ssge.MyObject[0] == "colisorDoAtaquebaixo")
        {
            mov.JumpForce();
        }

        Destroy(
            Instantiate(enemyParticleDamage, obj.Sender.transform.position, Quaternion.identity), 5);
    }