Exemple #1
0
 /*
  * Assign a color to the player's index in array and dict,
  * and add increment readyPlayers
  */
 public void selectColor(PLAYER_COLORS color, short index)
 {
     selectedColorsDict[color] = true;
     playersColors[index]      = color;
     readyPlayers++;
     // quickDebug();
 }
Exemple #2
0
 /*
  * Function will deselect the given player's color from array and dictionary.
  *  If it was selected before,
  * this will mean the player is not ready, and thus decrease the number of ready
  * players.
  */
 public void removeColor(PLAYER_COLORS color, short index)
 {
     // since PLAYER_COLOR.NONE is not in the dictionary, if the sent color
     // is it, we bail out immediately, knowing it was already Empty
     if (selectedColorsDict.ContainsKey(color) && selectedColorsDict[color] == true)
     {
         readyPlayers--;
     }
     playersColors[index]      = PLAYER_COLORS.NONE;
     selectedColorsDict[color] = false;
     // quickDebug();
 }
Exemple #3
0
    public void registerPlayerColor(int index, PLAYER_COLORS playerColor)
    {
        // playerStruct.index = (short)index;
        if (!gameInfoManager.ColorIsAlreadyChosen(playerColor))
        {
            if (currenColor != PLAYER_COLORS.NONE)
            {
                gameInfoManager.removeColor(currenColor, (short)playerIndex);
            }

            gameInfoManager.selectColor(playerColor, (short)playerIndex);
            setTexture(playerColorsImages[playerColor]);
            currenColor = playerColor;
        }
        else if (playerColor == currenColor)
        {
            gameInfoManager.removeColor(currenColor, (short)playerIndex);
            currenColor = PLAYER_COLORS.NONE;
            removeAlltextures();
        }
    }
Exemple #4
0
 /*
  * Players need different colors. If a color was already selected by another
  * player, function will return true.
  */
 public bool ColorIsAlreadyChosen(PLAYER_COLORS color)
 {
     // print(selectedColorsDict[color]);
     return(selectedColorsDict[color]);
 }
Exemple #5
0
 public static void changeMyRendererColor(Renderer renderer, PLAYER_COLORS color)
 {
     renderer.sharedMaterial = materialsDict[color];
 }
Exemple #6
0
 public void setCurrentColor(PLAYER_COLORS color)
 {
     currenColor = color;
 }