public GameObject getRandomBodyPart(Card.cardType requestedCardType) { int number; switch ((int)requestedCardType) { case 0: number = Random.Range(0, arms.Length); return(arms[number]); case 1: number = Random.Range(0, legs.Length); return(legs[number]); case 2: number = Random.Range(0, bodies.Length); return(bodies[number]); case 3: number = Random.Range(0, heads.Length); return(heads[number]); default: number = Random.Range(0, heads.Length); return(arms[number]); } }
// The below method will fill this list with 52 differnt cards. public void deckFiller() { // the loop will run 52 times. for (int i = 0; i < 52; i++) { Card.cardType card = (Card.cardType)(Math.Floor((decimal)i / 13)); // this line of code here takes the loop number and divides it by 13, the maths function keeps this number a decimal, // this number is then used to index the enum list in the cards class for the cards suit. int val = i % 13 + 1; // sets the number of time 13 can fit into the loop number to a variable. deckList.Add(new Card(val, card)); } }
public void SpawnCards(Card.cardType spawnCardType) { cards.Clear(); gottenItems.Clear(); //Clears the list of gotten items. So you can get all cards again. //Randomly Selecting a card: for (int i = 0; i < amountOfCards; i++) { GameObject cardItem; cardItem = itemsList.getItemObject(targetPlayer, (int)(rangeModifier / GameManager.instance.AmountOfPlayers()), gottenItems); //The second parameter is the range the itemlist has too look at. gottenItems.Add(cardItem); ItemInfo info = cardItem.GetComponent <ItemInfo>(); cards.Add(new Card(info.itemType, info.itemName, info.itemDescription, info.itemIcon, Card.cardState.unused, cardItem)); } cardsInWorld(); }
public CardConstructor(Card card) { this.cardName = card.cardName; this.cardDescription = card.cardDescription; this.cardtype = card.cardtype; this.cardslot = card.cardslot; this.cardManaCost = card.cardManaCost; this.cardHealth = card.cardHealth; this.cardMana = card.cardMana; this.cardArmor = card.cardArmor; this.cardMovement = card.cardMovement; this.cardAttack = card.cardAttack; this.cardConsumable = card.cardConsumable; this.cardArt = card.cardArt; this.validTargets = card.validTargets; this.cardConsumable = card.cardConsumable; this.cardModel = card.cardModel; }
public void AddCardToList(string name, GameObject image, string effect, Card.cardType type, Card.cardAttribute attribute, Card.monsterType mnType, Card.spellType sType, Card.trapType tType, int mAtk, int mDef, Card.cardState state, string ow) { cardList.Add(new Card(name, image, effect, type, attribute, mnType, sType, tType, mAtk, mDef, state, ow)); }