Esempio n. 1
0
    //Verifica si esta activado el modo AutoSpin.
    private void checkAutoSpin()
    {
        GameObject autoSpiner = GameObject.FindGameObjectWithTag("autoSpin");

        if (tickets.autoSpinIsActive() == false && autoPlay == false)
        {
            autoPlay = true;
            foreach (Transform children in autoSpiner.transform)
            {
                children.gameObject.SetActive(false);
            }
        }

        if (tickets.autoSpinIsActive() == true && autoPlay == true)
        {
            autoPlay = false;
            foreach (Transform children in autoSpiner.transform)
            {
                children.gameObject.SetActive(true);
            }
        }
    }
    void Update()
    {
        Info1.text = changeInformation.ToString();

        //Esperamos a que haya finalizado la tirada anterior para volver a tirar.
        if (!startSpin)
        {
            //Realizamos una nueva tirada.
            if (tickets.realizarTiradaBtn() || tickets.autoSpinIsActive())
            {
                //Impedimos otra tirada hasta finalizar esta.
                tickets.modificarRealizarTiradaBtn();

                //Miramos el coste de la tirada
                precioPorTirada = tickets.precioPorTirada();
                numTickets      = tickets.numTickets();

                //Si el coste de la tirada es inferior al dinero que tenemos, realizamos la tirada
                if (numTickets >= precioPorTirada)
                {
                    //Impedimos que se pueda modificar el numero de lineas y la apuesta por linea.
                    changeInformation = false;
                    //Vibramos el movil con la tirada
                    tickets.loseTickets(precioPorTirada);
                    startSpin = true;
                    StartCoroutine(Spinning());
                }
                else
                {
                    if (tickets.numTickets() < 500)
                    {
                        //Regalamos al jugador 1000 tickets si se queda sin tiquets.
                        tickets.winTickets(1000);
                    }
                }
            }
        }

        if (endTurn == true)
        {
            //Verifica la recompensa de la tirada.
            checkReward();
        }
    }