Example #1
0
    /// <summary>
    /// Called when a card is picked by the player
    /// </summary>
    /// <param name="card">The Card picked</param>
    public void OnCardPicked(CardType card)
    {
        handCards.Remove(card);
        Vector3 position = distanceBetweenScoreGroup;

        //Create the PlayingCard prefab to bring the card into 3D space
        playingCard = Instantiate(Deck.Instance().playingCardPrefab, handPosition.transform).GetComponent <PlayedCard>();
        playingCard.ApplyCard(Deck.Instance().deckInfo.byType(card));
        //pause the playing card, we will hold it in midair until everyone has picked a card
        playingCard.Pause();
        ScoreGroup foundGroup = null;

        foreach (ScoreGroup group in GetComponentsInChildren <ScoreGroup>())
        {
            if (group.CanPlayOnGroup(card))
            {
                foundGroup = group;
                break;
            }
            else
            {
                position = (new Vector3(group.transform.localPosition.x, 0, 0)) + distanceBetweenScoreGroup;
            }
        }
        if (!foundGroup)
        {
            foundGroup = CreateNewScoreGroupForCard(card, position);
        }
        playingCard.SetMoveRequest(foundGroup.GetNextCardMoveRequest());
        if (evtCardChosen != null)
        {
            evtCardChosen(this);
        }
        PassCardPack();
    }
 public void Winner(PlayedCard winningCard)
 {
     if (!_inprogress)
     {
         _hubConnection.SendAsync("RoundWinner", _game.Id, winningCard.PlayerId);
         _inprogress = true;
     }
 }
Example #3
0
 public PlayActionCard(PlayedCard cardToPlay)
 {
     if (!(cardToPlay.Card is IAction))
     {
         throw new ArgumentException("Card must be and action card.");
     }
     CardToPlay = cardToPlay;
 }
Example #4
0
    public override bool RemoveCard(string id)
    {
        IEnumerable <PlayedCard> list = playedCards.Where(playedCard => playedCard.Card.GetID() == id);
        PlayedCard card = list.ToArray()[0];

        if (card != null)
        {
            return(playedCards.Remove(card));
        }
        Debug.LogError("Couldn't remove card: " + id);
        return(false);
    }
Example #5
0
    public void Add(PlayedCard played)
    {
        if (_isResolving)
        {
            return;
        }

        moves.Add(played);
        physicalZone.PutOnBottom(played.Card);
        played.Member.Apply(m => m.Pay(played.Card.Cost));
        BattleLog.Write($"{played.Member.Name} Played {played.Card.name}");
    }
Example #6
0
    public void PlayAbilityCard(List <ITargetable> possibleTargets, int targetIndex)
    {
        AbilityCard targetCard = Hand.GetCard(targetIndex);

        //TODO figure out how to get possible targets
        //List<ITargetable> possibleTargets = ??
        //targetCard.Play(possibleTargets, CurrentTarget);
        // card should no longer exist in 'hand'
        Hand.Remove(targetIndex);
        // allow the next thing to grab it, if desired
        PlayedCard.Invoke(targetCard);
    }
Example #7
0
    /// <summary>
    /// Called when played
    /// </summary>
    /// <param name="obj">The card object that was played</param>
    private void OnCardInPlace(GameObject obj)
    {
        PlayedCard card = obj.GetComponent <PlayedCard>();

        cards.Add(card.card);
        if (cardPlayParticleSystem != null)
        {
            cardPlayParticleSystem.transform.position = obj.transform.position;
        }
        OnCardPlayedOnGroup(card.card);
        if (evtCardPlayed != null)
        {
            evtCardPlayed(card.card);
        }
    }
Example #8
0
    private IEnumerator ResolveOneCard(PlayedCard played)
    {
        BattleLog.Write($"Began resolving {played.Card.Name}");
        if (physicalZone.Count == 0)
        {
            Debug.Log($"Weird Physical Zone Draw bug.");
            yield break;
        }
        var card = physicalZone.DrawOneCard();

        played.Perform();
        LastPlayed = played;
        if (played.Member.TeamType.Equals(TeamType.Party))
        {
            playedDiscardZone.PutOnBottom(card);
        }
        onCardResolved.Publish();
    }
Example #9
0
 /// <summary>
 /// Called by Deck when everyone is ready to Play cards
 /// </summary>
 public void PlayCard()
 {
     SetNewState(PlayerState.PlayingCard);
     playingCard.Resume();
     playingCard = null;
 }
 public UpdateDealersSecondCardStateAfterPlayerCallCommand(ERoundState roundState, PlayedCard dealersSecondPlayedCard)
 {
     _roundState = roundState;
     _dealersSecondPlayedCard = dealersSecondPlayedCard;
 }