Beispiel #1
0
    public IEnumerator RollTheDice()
    {
        coroutineAllowed = false;
        int randomDiceSide = 0;

        for (int i = 0; i <= 10; i++)
        {
            randomDiceSide = Random.Range(0, 6);
            rend.sprite    = diceSides[randomDiceSide];
            yield return(new WaitForSeconds(0.05f));
        }

        Jugabilidad.diceSideThrown = randomDiceSide + 1;
        Jugabilidad.MovePlayer(whosTurn == 1 ? 1 : 0);
        if (!gotSix && randomDiceSide == 5)
        {
            gotSix = true;
        }
        else
        {
            whosTurn *= -1;
            gotSix    = false;
        }

        coroutineAllowed = true;
    }
Beispiel #2
0
    public void MoverFicha()
    {
        if (transform.position != destino.casilla.transform.position)
        {
            transform.position = Vector3.MoveTowards(transform.position,
                                                     destino.casilla.transform.position,
                                                     velocidad * Time.deltaTime);
        }
        else if (posicion < Jugabilidad.diceSideThrown)
        {
            actual  = destino;
            destino = destino.LigaConsecutiva;
            posicion++;
        }
        else
        {
            actual = destino;
            if (actual.Indicador != null && (int)actual.Indicador == 0)
            {
                destino = actual.LigaIndicadora;
            }
            else if (actual.Indicador != null && (int)actual.Indicador == 1)
            {
                destino = actual.LigaIndicadora;
            }
            else
            {
                puedeMover = false;
            }
        }
        if (!puedeMover)
        {
            ComprobarMaquina();
        }
        Rotar(destino);

        if (actual == LDL.ultimo)
        {
            Jugabilidad.GameOver();
        }
    }