Esempio n. 1
0
    public void OnUserSelected(Button pressButton)
    {
        List <Player> players = mRestaurantScript.getAlivePlayers();

        Debug.Log("PLAYER COUNT: " + players.Count + " | BUTTON COUNT: " + mPlayerNamecards.Count);

        for (int i = 0; i < mPlayerNamecards.Count; ++i)
        {
            mPlayerNamecards[i].image.color = Color.white;

            if (pressButton == mPlayerNamecards[i])
            {
                Debug.Log("HELLO1: " + mTurnManagerScript.GetCurrentPlayerIndex());
                Debug.Log("PLAYER COUNT: " + players.Count + " | BUTTON COUNT: " + mPlayerNamecards.Count);

                switch (players[mTurnManagerScript.GetCurrentPlayerIndex()].getRole())
                {
                case EnumPlayerRole.ASSASSIN:
                {
                    mRestaurantScript.SetPoisonedMealAtIndex(i);
                    mPlayerNamecards[i].image.color = Color.red;
                    Debug.Log("POISONED: " + players[i].getName());
                    break;
                }

                case EnumPlayerRole.DISTANT_COUSIN:
                {
                    if (isAssassinAlive())
                    {
                        mRestaurantScript.MarkPlayerAtIndex(i);
                        mPlayerNamecards[i].image.color = Color.blue;
                        Debug.Log("MARKED: " + players[i].getName());
                        players [i].setMarked(true);
                        break;
                    }
                    else
                    {
                        mRestaurantScript.SetPoisonedMealAtIndex(i);
                        mPlayerNamecards[i].image.color = Color.red;
                        Debug.Log("POISONED: " + players[i].getName());
                        break;
                    }
                }

                case EnumPlayerRole.PRIVATE_EYE:
                {
                    mRestaurantScript.setBuggedPlayer(players[i]);
                    mRestaurantScript.SetBuggedMealAtIndex(i);
                    mPlayerNamecards[i].image.color = Color.green;
                    Debug.Log("BUGGED: " + players[i].getName());
                    break;
                }
                }
            }
        }

        mDoneWithActionButton.transform.GetChild(0).GetComponent <Text>().text = "DONE";
        mDoneWithActionButton.interactable = true;
    }