Beispiel #1
0
 public void SetnormalDice()
 {
     dMode  = EDiceMode.NORMAL_DICE;
     images = images_Normal;
     //diceImage.sprite = images[0];
     dNumMin = 0;
     dNumMax = 6;
 }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.A))
        {
            dMode            = EDiceMode.NORMAL_DICE;
            images           = images_Normal;
            diceImage.sprite = images[0];
            dNumMin          = 0;
            dNumMax          = 6;
        }
        else if (Input.GetKey(KeyCode.B))
        {
            dMode            = EDiceMode.DICE_OTT;
            images           = images_123;
            diceImage.sprite = images[0];
            dNumMin          = 0;
            dNumMax          = 3;
        }
        else if (Input.GetKey(KeyCode.C))
        {
            dMode            = EDiceMode.DICE_FFS;
            images           = images_456;
            diceImage.sprite = images[0];
            dNumMin          = 3;
            dNumMax          = 6;
        }


        if (Input.GetKey(KeyCode.Space))
        {
            OnClickDice();
        }

        if (isRandom)
        {
            //サイコロが動いている間は常にnumを更新し、止まる直前の値をpreNumに格納する
            if (!rb2D.IsSleeping())
            {
                int num = Random.Range(dNumMin, dNumMax);
                if (dMode == EDiceMode.DICE_FFS)
                {
                    diceImage.sprite = images[num - 3];
                }
                else
                {
                    diceImage.sprite = images[num];
                }

                preNum = num;
            }
            else
            {
                Player1.GetComponent <PlayerMovement>().PlayerMove(preNum + 1);
                Debug.Log(preNum + 1);
                isRandom = false;
            }
        }
    }
Beispiel #3
0
 public void Set456Dice()
 {
     dMode            = EDiceMode.DICE_FFS;
     images           = images_456;
     diceImage.sprite = images[0];
     dNumMin          = 3;
     dNumMax          = 6;
     playerMovement.sai456[playerMovement.currentPlayer]--;
     UseItem();
 }
Beispiel #4
0
 public void Set123Dice()
 {
     dMode            = EDiceMode.DICE_OTT;
     images           = images_123;
     diceImage.sprite = images[0];
     dNumMin          = 0;
     dNumMax          = 3;
     playerMovement.sai123[playerMovement.currentPlayer]--;
     UseItem();
 }