IEnumerator Destroying() { if (chooseMultiCast.CardPlayed != null) { yield return(chooseMultiCast.CardPlayed.MoveTo(AllComponents.CardBuilder.Zone, timeAnimation: 0f).WaitForCompletion()); } yield return(new WaitWhile(() => DOTween.IsTweening("HorizontalOrder"))); foreach (CardComponent card in ListCardsEffect.Select(c => c.Card)) { card.CurrentZone.ListCards.Remove(card); card.CardTools.Destroy(); } ListCardsEffect.Clear(); }
/*****************************************************************************************/ public MultiCastAction(List <CardEffect> cardEffects, bool isOptionalChoice = true) { this.isOptionalChoice = isOptionalChoice; foreach (CardEffect effectStruct in cardEffects) { CardComponent cloneCard = effectStruct.Card.CardTools.Clone(); cloneCard.ID = effectStruct.Card.ID; cloneCard.CardLogic = new CardLogic().WithThisCard(cloneCard); cloneCard.CurrentZone = effectStruct.Card.MyOwnZone; cloneCard.transform.position = effectStruct.Card.transform.position; cloneCard.transform.rotation = effectStruct.Card.transform.rotation; cloneCard.CardSensor.StackerZone.transform.DOScale(0, 0); effectStruct.Card = cloneCard; effectStruct.Effect = new ActionsTools().JoinEffects(Destroying, effectStruct.Effect); ListCardsEffect.Add(effectStruct); GameControl.AllCardComponents.Add(cloneCard); } }