You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.9 KiB

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<CardDisplay>().card as MonsterCard;
monster.healthPoint -=_damage;//这里可以做积分记录,联系到文件中
if(monster.healthPoint <= 0)
{
Destroy(gameObject);
}
}
public void IncreaseDamage(GameObject _speller)
{
MonsterCard monster = GetComponent<CardDisplay>().card as MonsterCard;
SpellCard speller = _speller.GetComponent<CardDisplay>().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<CardDisplay>();
}
// Update is called once per frame
void Update()
{
}
}