Ejemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        KeyVar myKeys = GameController.g.MyKeys;

        if (collision.tag == "attackCollisor")
        {
            Debug.Log(myKeys.VerificaAutoCont(ID) + " os hits");
            myKeys.SomaAutoCont(ID, 1);
            int  moedasAgora;
            bool foi = myKeys.VerificaAutoCont(ID) < numHits;

            moedasAgora = numMoedas / (numHits + 1);

            if (!foi)
            {
                moedasAgora = numMoedas - (numHits - 1) * moedasAgora;
            }


            SpawnMoedas.Spawn(transform.position, moedasAgora);
            new MyInvokeMethod().InvokeNoTempoDeJogo(() =>
            {
                EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, "Break"));
            }, .3f);

            if (!foi)
            {
                myKeys.MudaAutoShift(ID, true);
                particulaDaFinalizacao.SetActive(true);
                Destroy(GetComponent <Collider2D>());
                Destroy(GetComponent <SpriteRenderer>());
                Destroy(gameObject, 5);
            }
        }
    }
Ejemplo n.º 2
0
 void Start()
 {
     AuxCameraAlvo   = GameObject.Find("CameraPrincipal").GetComponent <CameraAlvo> ();
     AuxSpawnMoedas  = GameObject.Find("LocaisInstMoedas").GetComponent <SpawnMoedas> ();
     AuxTempoPartida = GameObject.Find("TempoPartida").GetComponent <TempoPartida> ();
     if (Application.internetReachability != NetworkReachability.NotReachable)
     {
         Conectar();
     }
     else
     {
         PhotonNetwork.offlineMode = true;
         Conectar();
     }
 }
Ejemplo n.º 3
0
    void VerifiqueConfirmacao(GameObject qual)
    {
        CofreDosLosangulos c = null;

        for (int i = 0; i < cofres.Length; i++)
        {
            if (qual == cofres[i].gameObject)
            {
                Debug.Log("indice do cofre é: " + i);
                c = cofres[i];
            }
        }

        KeyVar myKeys = GameController.g.MyKeys;
        int    sum    = 0;

        for (int i = myKeys.VerificaCont(KeyCont.losangulosConfirmados); i < myKeys.VerificaCont(KeyCont.losangulosPegos); i++)
        {
            if (i >= c.InicioDeAcao - 1 && i < c.FinalDeAcao)
            {
                SouUmLosanguloGerenciavel s = transform.GetChild(i).GetComponent <SouUmLosanguloGerenciavel>();
                s.MySprite.sprite = spriteAmarelo;

                Debug.Log("filho " + i + " :" + s.name);

                GameObject G = Instantiate(particulaDaConfirmacao, s.transform.position, Quaternion.identity);
                G.SetActive(true);
                Destroy(G, 5);

                SpawnMoedas.Spawn(s.transform.position, Mathf.Max(5, i));
                sum++;
            }
        }

        if (sum > 0)
        {
            EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.somParaGetLosangulo));
            new MyInvokeMethod().InvokeNoTempoDeJogo(() =>
            {
                EventAgregator.Publish(new StandardSendGameEvent(EventKey.disparaSom, SoundEffectID.VariasMoedas));
            }, .35f);
        }

        myKeys.SomaCont(KeyCont.losangulosConfirmados, sum);

        Debug.Log(myKeys.VerificaCont(KeyCont.losangulosConfirmados) + " confirmados");
    }
 protected virtual void OnDefeated()
 {
     SpawnMoedas.Spawn(transform.position, premioEmDinheiro);
     Destroy(gameObject);
 }
Ejemplo n.º 5
0
 void Start()
 {
     AuxSpawnMoedas = GameObject.Find("LocaisInstMoedas").GetComponent <SpawnMoedas> ();
 }