public void handlePlayedColor(FieldColors color)
        {
            if (isComputerTurn)
            {
                if (fields.Count > internalComputerCounter)
                {
                    internalComputerCounter++;

                    if (fields.Count <= internalComputerCounter)
                    {
                        isComputerTurn = false;
                    }
                    else
                    {
                        PlayField(fields[internalComputerCounter], false);
                    }
                }
            }
            else
            {
                if (color == fields[internalPlayerCounter])
                {
                    internalPlayerCounter++;

                    if (fields.Count == internalPlayerCounter)
                    {
                        points++;
                        UpdatePoints(points);
                        isComputerTurn          = true;
                        internalPlayerCounter   = 0;
                        internalComputerCounter = 0;
                        performNewTurn();
                    }
                }
                else
                {
                    isGameRunning = false;
                    PlayGameOver();
                    UnlockElements();
                }
            }
        }
 private void PlayField(FieldColors field, bool rotate)
 {
     nextFieldColor = field;
     if (rotate)
     {
         if (isFirstTurn)
         {
             isFirstTurn = false;
             playNextFieldColor();
         }
         else
         {
             rotateGameField();
         }
     }
     else
     {
         playNextFieldColor();
     }
 }
Esempio n. 3
0
    public ColorAttribute(FieldColors color)
    {
        switch (color)
        {
        default:
            m_Color = new Color(0.76f, 0.76f, 0.76f, 1f);
            break;

        case FieldColors.Red:
            m_Color = new Color(1, 0.4f, 0.4f, 1f);
            break;

        case FieldColors.Orange:
            m_Color = new Color(1, 0.7f, 0.4f, 1f);
            break;

        case FieldColors.Yellow:
            m_Color = new Color(1, 1f, 0.4f, 1f);
            break;

        case FieldColors.Green:
            m_Color = new Color(0.4f, 1f, 0.4f, 1f);
            break;

        case FieldColors.Cyan:
            m_Color = new Color(0.4f, 1f, 1f, 1f);
            break;

        case FieldColors.Blue:
            m_Color = new Color(0.4f, 0.4f, 1f, 1f);
            break;

        case FieldColors.Magenta:
            m_Color = new Color(1, 0.4f, 1f, 1f);
            break;

        case FieldColors.Grey:
            m_Color = new Color(0.75f, 0.75f, 0.75f, 1f);
            break;
        }
    }