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.

71 lines
1.8 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public enum BattleCardState
{
inHand,inBlock
}
public class BattleCard : MonoBehaviour, IPointerDownHandler
{
public int playerID;
public BattleCardState state = BattleCardState.inHand;
public int AttackCount;
private int attackCount;
public void OnPointerDown(PointerEventData eventData)
{
if (BattleManager.Instance.gamePhase == GamePhase.playerAction|| BattleManager.Instance.gamePhase == GamePhase.enemyAction)
//if(BattleManager.Instance.gamePhase.ToString() == "playerAction")
{
if (GetComponent<CardDisplay>().card is MonsterCard)
{
//在手牌时发起召唤请求
if (state == BattleCardState.inHand)
{
BattleManager.Instance.SummonRequst(playerID, gameObject);
}
//在场上点击时发起攻击请求
else if (state == BattleCardState.inBlock && attackCount > 0)
{
BattleManager.Instance.AttackRequst(playerID, gameObject);
}
}
if (GetComponent<CardDisplay>().card is SpellCard)
{
//在手牌时发起效果请求
if (state == BattleCardState.inHand)
{
BattleManager.Instance.EffectRequst(playerID, gameObject);
}
}
}
}
public void ResetAttack()
{
attackCount = AttackCount;
}
public void CostAttackCount()
{
attackCount--;
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}