public void DamageHero(CardInfoScript card, bool isEnemyAttacked) { if (isEnemyAttacked) { EnemyHP = Mathf.Clamp(EnemyHP - card.SelfCard.Attack, 0, int.MaxValue); } else { PlayerHP = Mathf.Clamp(PlayerHP - card.SelfCard.Attack, 0, int.MaxValue); } ShowHP(); card.DeHighlightCard(); CheckForResult(); }
public void OnDrop(PointerEventData eventData) { if (!GetComponent <CardMovementScript>().GameManager.IsPlayerTurn) { return; } CardInfoScript card = eventData.pointerDrag.GetComponent <CardInfoScript>(); // атакующая карта if (card && card.SelfCard.CanAttack && transform.parent == GetComponent <CardMovementScript>().GameManager.EnemyField) { card.SelfCard.ChangeAttackState(false); if (card.IsPlayer) { card.DeHighlightCard(); } GetComponent <CardMovementScript>().GameManager.CardsFight(card, GetComponent <CardInfoScript>()); } }