private void HandleStartingGameState(StartingUserGameState startingState)
    {
        panelDisabler.Disable();

        PlayerIndex = startingState.PlayerIndex;
        int initHandSize = startingState.StartingDeck.Count;

        for (int i = 0; i < 2; i++)
        {
            playersControllers[i] = new PlayerControllersContainer
            {
                boardSideController = (i == PlayerIndex) ? playersBoardSideController : enemiesBoardSideController,
                dataController      = (i == PlayerIndex) ? playersDataController : enemiesDataController
            };
            playersControllers[i].dataController.HandSize  = initHandSize;
            playersControllers[i].dataController.DeckSize -= initHandSize;
        }

        foreach (var cardInGame in startingState.StartingDeck)
        {
            PrepareCardInGame(cardInGame);
            playersHandController.AddCard(cardInGame);
        }
    }
Exemplo n.º 2
0
 public int GiveCard(HandController hand, int index, bool remove)
 {
     if (localDeck.Cards.Count > 0)
     {
         localDeck.Cards[index].isOnScreen = false;
         hand.AddCard(localDeck.Cards[index]);
         if (remove)
         {
             Destroy(localDeck.Cards[index].gameobj);
             localDeck.Cards.RemoveAt(index);
             localDeck.Render();
         }
         return(0);
     }
     return(-1);
 }
Exemplo n.º 3
0
 public void Draw(int amounts)
 {
     for (int i = 0; i < amounts; i++)
     {
         if (model.cards.Count <= 0)
         {
             if (trash.model.cards.Count <= 0)
             {
                 return;
             }
             foreach (var c in trash.model.cards)
             {
                 AddWholeCard(c);
             }
             trash.model.cards.Clear();
         }
         CardController card = model.cards[Random.Range(0, model.cards.Count)];
         model.cards.Remove(card);
         hand.AddCard(card);
     }
 }