Пример #1
0
    private void Start()
    {
        Debug.Log("ANTES DE TODO " + anim_gen.Length);
        startparametros();


        ///bd
        //param = GameObject.Find("Parametros");
        // prm = param.GetComponent<Parametros>();
        rutas = aleatorios();
        Debug.Log("aqui");
        Debug.Log("cantidad " + rutas.Length);
        for (int i = 0; i < rutas.Length; i++)
        {
            fruta     = Resources.Load <Sprite>(rutas[i]);
            images[i] = fruta;

            Debug.Log("FRUTA FINAL Final" + fruta);
        }


        /////copiar al siguiente nivel
        aux = GameObject.Find("Auxiliar");
        sss = new SonidoFrutaTres();
        /////


        Vector3 startPos = originalCard.transform.position;

        int[] numbers = { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 };
        //randon del array
        numbers = ShuffleArray(numbers);

        for (int i = 0; i < griCols; i++)
        {
            for (int j = 0; j < griRows; j++)
            {
                cartaTres card;
                if (i == 0 && j == 0)
                {
                    card = originalCard;
                }
                else
                {
                    card = Instantiate(originalCard) as cartaTres;
                }

                int index = j * griCols + i;
                int id    = numbers[index];
                card.ChangeSprite(id, images[id]);

                float posX = (offsetX * i) + startPos.x;
                float posY = (offeseY * j) + startPos.y;

                card.transform.position = new Vector3(posX, posY, startPos.z);
            }
        }
    }
Пример #2
0
    private void Start()
    {
        /////copiar al siguiente nivel
        aux = GameObject.Find("Auxiliar");
        GameObject go = new GameObject();

        go.AddComponent <SonidoFrutaTres>();
        sss = go.GetComponent <SonidoFrutaTres>();
//        sss = new SonidoFrutaTres();
        /////


        Vector3 startPos = originalCard.transform.position;

        int[] numbers = { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 };
        //randon del array
        numbers = ShuffleArray(numbers);

        for (int i = 0; i < griCols; i++)
        {
            for (int j = 0; j < griRows; j++)
            {
                cartaTres card;
                if (i == 0 && j == 0)
                {
                    card = originalCard;
                }
                else
                {
                    card = Instantiate(originalCard) as cartaTres;
                }

                int index = j * griCols + i;
                int id    = numbers[index];
                card.ChangeSprite(id, images[id]);

                float posX = (offsetX * i) + startPos.x;
                float posY = (offeseY * j) + startPos.y;

                card.transform.position = new Vector3(posX, posY, startPos.z);
            }
        }
    }
Пример #3
0
    private IEnumerator CheckedMatch()
    {
        if (_firstReveaLed.id == _sconReveaLed.id)
        {
            ////// copiar al siguiente nivel sonido
            string   im    = _sconReveaLed.GetComponent <SpriteRenderer>().sprite.ToString();
            string[] et    = im.Split(' ');
            string   n_fru = et[0];
            //Debug.Log(n_fru);//para mostrar el nombre de la fruta
            sss = aux.GetComponent <SonidoFrutaTres>();
            sss.nombrar_fruta(n_fru);
            ///////



            _score++;
            scoreLabel.text = "Puntaje: " + _score;
            if (_score == 6)
            {
                //tiempo de espera para cambio de escena ----> copiar al siguiente nivel
                yield return(new WaitForSeconds(2.0f));

                SceneManager.LoadScene("ganarTercerNivel");
            }
        }
        else
        {
            yield return(new WaitForSeconds(0.5f)); //tiempo que espera voltear carta cuando esta mal

            // Debug.Log(_firstReveaLed.id);

            _firstReveaLed.Unreveal();
            _sconReveaLed.Unreveal();
        }

        _firstReveaLed = null;
        _sconReveaLed  = null;
    }