Example #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));
            }
        }
    }
Example #2
0
    // Start is called before the first frame update
    void Start()
    {
        KeyVar kv = GameController.g.MyKeys;

        if (ExistenciaDoController.AgendaExiste(Start, this))
        {
            if (kv.VerificaEnemyShift(ID))
            {
                Desativar();
            }
            else
            {
                if (!kv.VerificaEnemyShift("limparContPentagono" + ID))
                {
                    kv.MudaAutoCont(ID, 0);
                }
            }
        }
    }