private GameObject InstantiateCardGameObject(Vector2 suggestedCardSize, Vector3 pos, bool faceUp, Suit suit = Suit.None, int value = -1, int cardsBelow = 0) { if (faceUp && (suit == Suit.None || value == -1)) { Debug.LogError("value and suit parameters must be provided for faceup cards"); } GameObject cardGO = this.InstantiateAndScale(cardPrefab, suggestedCardSize, pos); CardView cardView = cardGO.GetComponent <CardView>(); cardView.isFaceUp = faceUp; cardGO.transform.parent = cardsContainer; Sprite suitSprite = SpritesProvider.LoadSuitSprite(suit); cardView.bigSuit.sprite = suitSprite; cardView.smallSuit.sprite = suitSprite; cardView.value.sprite = SpritesProvider.LoadValueSprite(value); cardView.SetSortingOrderAndZDepth(cardsBelow, false); cardView.front.SetActive(faceUp); cardView.back.SetActive(!faceUp); cardView.bigSuit.sprite = suitSprite; return(cardGO); }
private GameObject InstantiateFoundationPile(Vector2 suggestedCardSize, float y_padding_worldSpace, Suit suit, Vector3 tableuColumn_pos) { Vector3 targetPos = tableuColumn_pos + new Vector3(0, y_padding_worldSpace + suggestedCardSize.y, 0); GameObject foundationPileGO = this.InstantiateAndScale(foundationPilePrefab, suggestedCardSize, targetPos); CardView cardView = foundationPileGO.GetComponent <CardView>(); foundationPileGO.transform.parent = cardsContainer; cardView.bigSuit.sprite = SpritesProvider.LoadSuitSprite(suit); cardView.SetSortingOrderAndZDepth(-1); foundationPileGO.name = "Foundation_" + suit.ToString(); return(foundationPileGO); }