Exemple #1
0
    private void CheckRoll(string data)
    {
        //if have not rolled yet, do it now
        if (myRoll == -1)
        {
            RollDiceForFirst();
        }

        NetworkRollFirst roll = JsonUtility.FromJson <NetworkRollFirst>(data);

        if (myRoll > roll.rollAmount)
        {
            //go first
            playerHand.enabled = true;
        }
        else if (myRoll < roll.rollAmount)
        {
            //go second
        }
        else
        {
            myRoll = -1;
            //roll again :|
            RollDiceForFirst();
        }
    }
Exemple #2
0
    private void RollDiceForFirst()
    {
        if (myRoll != -1)
        {
            return;
        }

        //roll numbers between 0-1000 to decide who goes first
        NetworkRollFirst roll = new NetworkRollFirst();

        roll.rollAmount = UnityEngine.Random.Range(0, 1000);
        myRoll          = roll.rollAmount;
        SocketIOClient.Send(JsonUtility.ToJson(roll));
    }