示例#1
0
        public void Randomize()
        {
            int randomPieceType = ListUtils.GetRandomElement <int>(GameRules.GetPieceTypes());

            SetPieceType(randomPieceType);
            SendModelChangedEvent();
        }
示例#2
0
    /// <summary>
    /// Gets the random complete condition.
    /// </summary>
    /// <returns>The random complete condition.</returns>
    public int GetRandomCompleteCondition()
    {
        int amount = 0;

        if (completeConditions != null && completeConditions.Count > 0)
        {
            amount = ListUtils.GetRandomElement <int>(completeConditions);
        }

        return(amount);
    }
示例#3
0
        private void FillBoard()
        {
            int pieceIndex = 0;

            for (int i = 0; i < BoardPieces.GetLength(0); ++i)
            {
                for (int j = 0; j < BoardPieces.GetLength(1); ++j)
                {
                    int randomPieceType = ListUtils.GetRandomElement <int>(GameRules.GetPieceTypes());
                    BoardPieces[i, j] = GamePieceFactory.Create(randomPieceType, pieceIndex);
                    pieceIndex++;
                }
            }
        }
示例#4
0
    //////////////////////////////////////////
    /// SetUpBoard()
    //////////////////////////////////////////
    private void SetUpBoard()
    {
        // first get all of the pieces
        GamePiece_Draft[]      arrayPieces = gameObject.GetComponentsInChildren <GamePiece_Draft>();
        List <GamePiece_Draft> listPieces  = new List <GamePiece_Draft>(arrayPieces);

        foreach (GamePiece_Draft piece in listPieces)
        {
            // choose a random color
            AbilityColors eColor = ListUtils.GetRandomElement <AbilityColors>(ValidColors);
            Color         color  = PieceColors[(int)eColor];

            // set that color onto the piece
            piece.SetColor(eColor, color);
        }
    }