示例#1
0
    private void DeckClicked(int cardId, string cardGuid)
    {
        EncounterCardWrapper wrapper = new EncounterCardWrapper((EncounterCard)DefaultResources.GetCardById(cardId, DefaultResources.CardType.Encounter), cardGuid);

        CardBehaviour cardBehaviour = CardsLayoutManager.Instance.CreateCardIn(wrapper, CardsLayoutManager.SlotType.EncounterDeck);

        CardsLayoutManager.Instance.MoveCardTo(cardBehaviour, CardsLayoutManager.SlotType.CurrentEncounter, () =>
        {
            cardBehaviour.GetComponent <EncounterCardVisual>().ShowVariants();
        });
    }
示例#2
0
    void ValidateVictoryCard()
    {
        CardType playerCard   = selected;
        CardType computerCard = computer.type;

        computer.FadeOut();

        switch (selected)
        {
        case CardType.PAPER:
            paper.GetComponent <SpriteRenderer>().enabled = false;
            break;

        case CardType.ROCK:
            rock.GetComponent <SpriteRenderer>().enabled = false;
            break;

        case CardType.SCISSOR:
            scissor.GetComponent <SpriteRenderer>().enabled = false;
            break;
        }

        if (playerCard.Equals(computerCard))
        {
            texts.DefineResult(GameResult.DRAW);
        }
        else if ((playerCard.Equals(CardType.ROCK) && computerCard.Equals(CardType.SCISSOR)) ||
                 (playerCard.Equals(CardType.PAPER) && computerCard.Equals(CardType.ROCK)) ||
                 (playerCard.Equals(CardType.SCISSOR) && computerCard.Equals(CardType.PAPER)))
        {
            texts.DefineResult(GameResult.PLAYER1_VICTORY);
            texts.PlayerVictory();
        }
        else
        {
            texts.DefineResult(GameResult.PLAYER2_VICTORY);
            texts.ComputerVictory();
        }
    }