using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public class AttackTarget : MonoBehaviour, IPointerClickHandler { public bool attackable; public bool effectable; //CardDisplay display;//为了适应可以攻击如玩家或者一些非卡牌的场上物品 public void OnPointerClick(PointerEventData eventData) { if(attackable) { //if (display != null) //{ // BattleManager.Instance.AttackConfirm(gameObject); //} //else //{ // BattleManager.Instance.AttackConfirm(); //} BattleManager.Instance.AttackConfirm(gameObject); } if(effectable) { BattleManager.Instance.EffectConfirm(gameObject); } } public void ApplyDamage(int _damage) { MonsterCard monster = GetComponent().card as MonsterCard; monster.healthPoint -=_damage;//这里可以做积分记录,联系到文件中 if(monster.healthPoint <= 0) { Destroy(gameObject); } } public void IncreaseDamage(GameObject _speller) { MonsterCard monster = GetComponent().card as MonsterCard; SpellCard speller = _speller.GetComponent().card as SpellCard; if(speller.effectvalue == 555)//特殊检索神奇护符,非常简陋的方法迫不得已。 { monster.attack += Random.Range(1, 4); } else { monster.attack += speller.effectvalue; } Destroy(_speller);//销毁魔法卡 } // Start is called before the first frame update void Start() { //display = GetComponent(); } // Update is called once per frame void Update() { } }