Esempio n. 1
0
    private IEnumerator CheckForDieSide()
    {
        yield return(new WaitForSeconds(1.5f));

        int value = d.GetComponent <DieSides>().GetDieSideMatchInfo().closestMatch.values[0];

        value += mod;
        mod    = 0;
        yield return(new WaitForSeconds(1f));

        Destroy(d.gameObject);
        result.text = value.ToString();

        if (rollingPlayer || rollingEnemy)
        {
            if (rollingColor == "WHITE")
            {
                result.color = Color.white;
            }
            if (rollingColor == "BLACK")
            {
                result.color = Color.black;
            }
        }
        else
        {
            if (tc.whiteTurn)
            {
                result.color = Color.white;
            }
            else
            {
                result.color = Color.black;
            }
        }

        result.gameObject.SetActive(true);

        yield return(new WaitForSeconds(1));

        result.gameObject.SetActive(false);
        isActive = false;
        yield return(new WaitForSeconds(1));

        if (rollingPlayer)
        {
            cc.playerRoll = value;
            cc.RollForEnemy();
            rollingPlayer = false;
            rolled        = false;
            yield break;
        }
        if (rollingEnemy)
        {
            cc.enemyRoll = value;
            cc.Resolve();
            rollingEnemy = false;
            rolled       = false;
            yield break;
        }
        else
        {
            currentPiece.SetMovement(value + 1);
            rolled = false;
        }
    }