Exemplo n.º 1
0
    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));
            }
        }
    }
Exemplo n.º 2
0
    void Recupera()
    {
        DadosDoJogador dj = GameController.g.Manager.Dados;

        tempoDecorrido = 0;

        if (dj.PontosDeMana < dj.MaxMana)
        {
            dj.AdicionarMana(taxaDeRecuperacao);
            EventAgregator.Publish(new StandardSendGameEvent(EventKey.changeMagicPoints, dj.PontosDeMana, dj.MaxMana));

            InstanciaLigando.Instantiate(particulaDaAcao, GameController.g.Manager.transform.position);
        }
    }