IEnumerator ThrowToDiscard(CardInHand card) { card.transform.SetParent(transform.parent); card.StartChanging(selectPosition.localPosition, 0, 1.5f); GameObject cardGO = card.gameObject; yield return(new WaitForSeconds(1f)); card.StartChanging(discardPilePosition.localPosition, 0, 0); StartCoroutine(DestroyCard(cardGO)); }
IEnumerator ThrowToDiscard(CardInHand card) { GameObject cardGO = card.gameObject; yield return(new WaitForSeconds(1f)); card.StartChanging(discardPile.localPosition, 0, 0); card.transform.SetParent(FindObjectOfType <Canvas>().transform); StartCoroutine(DestroyCard(cardGO)); }
public void DiscardCard(CardInHand card, bool animate) { UnselectCard(); card.active = false; card.GetComponentInChildren <Button>().interactable = false; cardsInHand.Remove(card); if (animate) { StartCoroutine(ThrowToDiscard(card)); } else { card.StartChanging(discardPile.localPosition, 0, 0); card.transform.SetParent(FindObjectOfType <Canvas>().transform); StartCoroutine(DestroyCard(card.gameObject)); } RecalculateCardPositions(); }