private bool attemptMoves(int playerId, List <MoveRequest> moveRequests, bool shouldResolveScore)
    {
        Assert.IsNotNull(moveRequests);

        int count = moveRequests.Count;

        for (int i = 0; i < count; ++i)
        {
            MoveRequest request = moveRequests[i];
            if (request == MoveRequest.Invalid())
            {
                continue;
            }

            PlayerState player = _gameMatchCore.matchState.playerGroup.GetPlayerByIndex(request.playerIndex);

            int scoreDelta = 0;
            int oldScore   = player.score;

            MoveResult moveResult = new MoveResult();
            moveResult.usedIngredient = player.hand.GetCard(request.handSlot).id;
            Debug.LogError("Setting Ingredient: " + moveResult.usedIngredient);

            bool result = _gameMatchCore.PlayCardOnCustomer(request);
            if (!result)
            {
                PhotonPlayer badGuy = _networkManager.GetPlayerById(playerId);
                Debug.LogErrorFormat("Player: {0}:{1} tried to make illegal move! {2}:{3}:{4}",
                                     playerId,
                                     badGuy.NickName,
                                     request.playerIndex,
                                     request.handSlot,
                                     request.customerSlot);
                return(false);
            }

            if (shouldResolveScore)
            {
                onResolveScore(request.customerSlot);
                scoreDelta = player.score - oldScore;
            }

            moveResult.request    = request;
            moveResult.addedScore = scoreDelta;

            _moveResultList.Add(moveResult);
        }

        return(true);
    }
Exemple #2
0
 private bool onPlayCard(MoveRequest move)
 {
     return(_gameMatchCore.PlayCardOnCustomer(move));
 }