void NewCard(CardNumbeType CNT, CardColorType CCT) { GameObject GCard = Instantiate(objCard, this.transform); Card card = GCard.GetComponent <Card>(); Heaps.Add(card); card.SetCardSprite(CNT, CCT); }
public void SetCardSprite(CardNumbeType cardNumbeType, CardColorType cardColorType) { if (cardColorType != CardColorType.NNull) { this.cardColorType = cardColorType; } if (cardNumbeType != CardNumbeType.NNull) { this.cardNumbeType = cardNumbeType; } string name = cardColorType.ToString() + (cardNumbeType.ToString()).Substring(1, cardNumbeType.ToString().Length - 1); Debug.Log(name); GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Textures/" + name); }