Beispiel #1
0
 void SpawnBoardCard(BoardCardSpawner cardSpawner, Card card)
 {
     if (cardSpawner != null)
     {
         SpawnBoardCardCommand spawnBoardCardCommand = new SpawnBoardCardCommand(cardSpawner, card);
         BoardCard             spawnedBoardCard;
         spawnedBoardCard = _commandInvoker.ExecuteReturnBoardCard(spawnBoardCardCommand, card);
         //Checking to see if board card is properly spawned before continuing turn
         if (spawnedBoardCard != null)
         {
             card.Play();
             _uiController.UpdateDateText(_uiController.Date.Name + " plays " + card.Name);
         }
     }
 }
Beispiel #2
0
    private void PlayRandomCard()
    {
        int  cardIndex  = RandomHelper.RandomIntLessThan(_dateHandPlayable.Count);
        Card targetCard = _dateHandPlayable.Cards[cardIndex];

        _cardToPlace = targetCard;
        bool spaceFound = false;

        //Taking out the card to place and returning the rest to the hand
        _dateHandPlayable.Remove(cardIndex);
        _dateHand.Add(_dateHandPlayable.Cards);
        foreach (BoardCardSpawner space in _dateFieldOpen)
        {
            if (spaceFound == false)
            {
                if (space.CardTypesMatch(_cardToPlace.CardType))
                {
                    _spaceToPlaceAt = space;
                    spaceFound      = true;
                }
            }
        }
        SpawnBoardCard(_spaceToPlaceAt, _cardToPlace);
    }
Beispiel #3
0
 void AssignBoardCardSpawner()
 {
     _boardCardSpawner = _hitInfo.collider.gameObject.GetComponent <BoardCardSpawner>();
 }
 public SpawnBoardCardCommand(BoardCardSpawner boardSpawner, Card card)
 {
     _boardCardSpawner = boardSpawner;
     _card             = card;
 }