public void PlayCard(int id) // Play a card { currentDiscard.Add(id); // if( discard > 0 ) make discard pile visable // make discard pile sprite be last discarded card //currentHand.RemoveAt(randomCard); if (id < 1000) // If the card is a melee card { SO_CardMelee card = cardDataBase.FindMeleeCardByID(id); Melee(id, card.normalDamage, card.bluntDamage, card.piercingDamage, card.poisonDamage); PrintLog("you just played " + card.name, "green"); } else if (id < 2000) { SO_CardArmor card = cardDataBase.FindArmorCardByID(id); Defence(id, card.armorBonus, card.spickedBonus); PrintLog("you just played " + card.name, "green"); } else if (id < 3000) { CardUtility card = cardDataBase.FindUtilityCardByID(id); PrintLog("you just played " + card.name, "green"); Utility(id); } else if (id < 4000) { CardCurse card = cardDataBase.FindCurseCardByID(id); PrintLog("You got cursed by" + card.name, "red"); card.PlayedFunction(); } }
void Start() { cardDataBase = GameObject.FindObjectOfType <Sc_CardDataBase>(); battleManager = GameObject.FindObjectOfType <Sc_BattleManager>(); endPointDiscardX = GameObject.Find("DiscardPile").transform.position.x; endPointDiscardY = GameObject.Find("DiscardPile").transform.position.y; endPointY = -4.4f; Sc_BattleManager.currentHandObjects.Add(this.gameObject); // Add it to the array which holds all card objects placementInHand = Sc_BattleManager.currentHandObjects.Count; // Saves is place in the array // Vector3 newPosition = new Vector3 (1.1f * placementInHand, 2.2f, 0); // Just places it the right place // this.transform.position = newPosition; // Set the background of the card background = this.gameObject.transform.GetChild(0).gameObject; SpriteRenderer backgroundSR = background.GetComponent <SpriteRenderer>(); description = this.gameObject.transform.GetChild(1).gameObject; banner = this.gameObject.transform.GetChild(2).gameObject; leftIcon = this.gameObject.transform.GetChild(3).gameObject; rightIcon = this.gameObject.transform.GetChild(4).gameObject; leftBonusIconOne = this.gameObject.transform.GetChild(5).gameObject; leftBonusIconTwo = this.gameObject.transform.GetChild(6).gameObject; if (cardID < 1000) { SO_CardMelee card = cardDataBase.FindMeleeCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; SetMeleeText(); } else if (cardID < 2000) { SO_CardArmor card = cardDataBase.FindArmorCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; SetArmorText(); } else if (cardID < 3000) { CardUtility card = cardDataBase.FindUtilityCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; SetUtilityText(); } else if (cardID < 4000) { CardCurse card = cardDataBase.FindCurseCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; } // Get other components }
public void SetCurse() { hasSpecial = true; CardCurse card = cardDataBase.FindCurseCardByID(id); backgroundSR.sprite = card.image; print(card.GetType().Name); if (card.GetType().Name == "SO_CurseAP") { specialTitle.text = "Loss of AP"; specialDescription.text = "When this card is drawn, you lose some ap"; } else if (card.GetType().Name == "SO_CurseBomb") { specialTitle.text = "Bomb"; specialDescription.text = "When drawn, every one takes damage"; } }
public void SetCurseText() { CardCurse card = cardDataBase.FindCurseCardByID(cardID); // set description text GameObject descriptionText = description.gameObject.transform.GetChild(0).gameObject; TextMesh descriptionTextR = descriptionText.GetComponent <TextMesh>(); descriptionTextR.text = card.decription; // set banner and name text SpriteRenderer bannerSR = banner.GetComponent <SpriteRenderer>(); GameObject nameText = banner.gameObject.transform.GetChild(0).gameObject; TextMesh nameTextR = nameText.GetComponent <TextMesh>(); bannerSR.sprite = armorBanner; nameTextR.text = card.name; // Set the left Icon Destroy(leftIcon); // Set the Right Icon Destroy(rightIcon); // Set the left bonus one icon Destroy(leftBonusIconOne); // Set the left bonus two icon Destroy(leftBonusIconTwo); }