public void OnDrop(PointerEventData eventData) { if (Type != FieldType.SELF_FIELD) { return; } CardMovementScript card = eventData.pointerDrag.GetComponent <CardMovementScript>(); if (card) { if (int.Parse(Gold.text) - card.GetComponent <CardGiven>().Cost >= 0) { Gold.text = (int.Parse(Gold.text) - card.GetComponent <CardGiven>().Cost).ToString(); } else { return; } card.GameManager.PlayerHandCards.Remove(card.GetComponent <CardGiven>()); // card.GameManager.PlayerFieldCards.Add(card.GetComponent <CardGiven>()); // peremischayem carty z kolekzijj ryku v kolekziyu polya card.DefaultParent = transform; } }
public void OnDrop(PointerEventData eventData) { if (type != FieldType.SELF_FIELD) { return; } CardMovementScript card = eventData.pointerDrag.GetComponent <CardMovementScript>(); if (card && card.GameManager.PlayerFieldCards.Count < 6 && card.GameManager.IsPlayerTurn) { card.GameManager.PlayerHandCards.Remove(card.GetComponent <CardInfoScr>()); card.GameManager.PlayerFieldCards.Add(card.GetComponent <CardInfoScr>()); card.DefaultParent = transform; } }
public void OnDrop(PointerEventData eventData) { if (Type != FieldType.SELF_FIELD) { return; } CardMovementScript card = eventData.pointerDrag.GetComponent <CardMovementScript>(); if (card && card.GameManager.PlayerFieldCards.Count < 5 /*карт на столе*/ && card.GameManager.IsPlayerTurn && card.GameManager.PlayerEnergy >= card.GetComponent <CardInfoScript>().SelfCard.Cost && !card.GetComponent <CardInfoScript>().SelfCard.IsPlaced) { card.GameManager.PlayerHandCards.Remove(card.GetComponent <CardInfoScript>()); card.GameManager.PlayerFieldCards.Add(card.GetComponent <CardInfoScript>()); card.DefaultParent = transform;//изменение родителя карты при переносе card.GetComponent <CardInfoScript>().SelfCard.IsPlaced = true; card.GameManager.ReduceEnergy(true, card.GetComponent <CardInfoScript>().SelfCard.Cost);//отнимание маны card.GameManager.CheckCardsForAvailability(); } }