public void AttackPlayer(V_Card card, playerTypes who) { if (who == playerTypes.Us) { GameObject targetPlayer = GameObject.FindGameObjectWithTag("Player"); card.GetComponent <V_CardActions> ().UseToPlayer(targetPlayer); } if (who == playerTypes.AI) { GameObject targetPlayer = GameObject.FindGameObjectWithTag("AIPlayer"); card.GetComponent <V_CardActions> ().UseToPlayer(targetPlayer); } }
public void ConvertToEnergy() { if (curSelected != null) { V_PlayerHandler.energy += curSelected.energyCost; curSelected.isDestroyed = true; curSelected.isConverted = true; curSelected.GetComponent <V_CardActions>().DestroyThisCard(); } }
/*public void AISelect(){ if (!isUsed && gameObject.tag == "AIOwned") { if (isSelected) { gm.GetComponent<V_GameManager> ().aiCurSelected = null; isSelected = false; } else { isSelected = true; gm.GetComponent<V_GameManager> ().aiCurSelected = gameObject.GetComponent<V_Card> (); Debug.Log ("AI has selected a card!"); } } }*/ public void Use(V_Card target){ V_Card thisCard = this.GetComponent<V_Card> (); Debug.Log ("AI attacked!"); if (target.gameObject.tag == "AIOwned" && this.tag == "PlayerOwned") { if (thisCard.type == V_Card.cardType.Close_Rage_Creature) { // Enemy damaged effect: Text enemy = Instantiate (V_GameManager.sdamageEffect, target.transform) as Text; enemy.text = "-" + thisCard.attackDamage; // We damaged effect: Text us = Instantiate (V_GameManager.sdamageEffect, thisCard.transform) as Text; us.text = "-" + target.attackDamage; // target.health -= thisCard.attackDamage; thisCard.health -= target.attackDamage; thisCard.DoEffect (); DestroyThisCard (); target.GetComponent<V_CardActions> ().DestroyThisCard (); isUsed = true; } } if (target.gameObject.tag == "PlayerOwned" && this.tag == "AIOwned") { if (thisCard.type == V_Card.cardType.Close_Rage_Creature) { Debug.Log ("AI attacked!"); // Enemy damaged effect: Text enemy = Instantiate (V_GameManager.sdamageEffect, target.transform) as Text; enemy.text = "-" + thisCard.attackDamage; // We damaged effect: Text us = Instantiate (V_GameManager.sdamageEffect, thisCard.transform) as Text; us.text = "-" + target.attackDamage; // target.health -= thisCard.attackDamage; thisCard.health -= target.attackDamage; thisCard.DoEffect (); DestroyThisCard (); target.GetComponent<V_CardActions> ().DestroyThisCard (); isUsed = true; } } }