Пример #1
0
    public void SetUpCard(Sprite back, Sprite front, GameEnums.SuitEnum suitEnum, int value, Image View)
    {
        //Debug.Log("Deck Count: " + RuntimeDeck.Count());
        this.back   = back;
        this.front  = front;
        View.sprite = back;

        this.suitEnum = suitEnum;
        // this.card = card;
        cardEnum = (GameEnums.CardEnum)value;
    }
Пример #2
0
    public void SetUpCard(Sprite back, Sprite front, GameEnums.SuitEnum suitEnum, int value)
    {
        //Debug.Log("Deck Count: " + RuntimeDeck.Count());
        this.back   = back;
        this.front  = front;
        View.sprite = back;

        this.suitEnum = suitEnum;

        cardEnum = (GameEnums.CardEnum)value;

        cardInternal.SetUpCard(back, front, suitEnum, value, View);
        gameObject.name = suitEnum.ToString() + cardEnum.ToString();
    }
Пример #3
0
    public int CreateDeck(IDeck deck, string DiamondsLocation, string ClubsLocation, string HeartsLocation,
                          string SpadesLocation,
                          string CardsBackLocation, GameObject Card, GameObject creatorObject, bool needRealObject)
    {
        deck.Clear();
        //Create card deck
        //get the individual sprites, not sure how i will get the art yet(temp)
        //loaded fro resources, but asset bundles can also be used
        Sprite[] diamonds = Resources.LoadAll <Sprite>(DiamondsLocation);
        Sprite[] clubs    = Resources.LoadAll <Sprite>(ClubsLocation);
        Sprite[] hearts   = Resources.LoadAll <Sprite>(HeartsLocation);
        Sprite[] spades   = Resources.LoadAll <Sprite>(SpadesLocation);
        Sprite   back     = Resources.Load <Sprite>(CardsBackLocation);

        // CardData cardObject = null;
        //create a temp enum for the type of card
        GameEnums.SuitEnum cardtype = GameEnums.SuitEnum.Clubs;

        //create a parent for all the cards
        GameObject parent = creatorObject;

        for (int i = 0; i < diamonds.Length; i++)
        {
            cardtype = GameEnums.SuitEnum.Diamonds;
            Card newCard = myInstantiate(Card, parent.transform, needRealObject);
            newCard.SetUpCard(back, diamonds[i], cardtype, i + 1);
        }
        for (int i = 0; i < clubs.Length; i++)
        {
            cardtype = GameEnums.SuitEnum.Clubs;
            Card newCard = myInstantiate(Card, parent.transform, needRealObject);
            newCard.SetUpCard(back, clubs[i], cardtype, i + 1);
        }

        for (int i = 0; i < hearts.Length; i++)
        {
            cardtype = GameEnums.SuitEnum.Hearts;
            Card newCard = myInstantiate(Card, parent.transform, needRealObject);
            newCard.SetUpCard(back, hearts[i], cardtype, i + 1);
        }

        for (int i = 0; i < spades.Length; i++)
        {
            cardtype = GameEnums.SuitEnum.Spades;
            Card newCard = myInstantiate(Card, parent.transform, needRealObject);
            newCard.SetUpCard(back, spades[i], cardtype, i + 1);
        }
        return(deck.Count());
    }