public override void OnItemDropped(CardView card) { base.OnItemDropped(card); int siblignIndexToDrop = transform.childCount; if (placeholderIsActive) { siblignIndexToDrop = placeholderSiblingIndex; } placeholderIsActive = false; DropCard(card, siblignIndexToDrop); //card.transform.DOKill(); /*card.transform.DOLocalMove(GetPositionForChild(card.transform.GetSiblingIndex()), cardDropSpeed).OnKill(() => { * scrollableComponent.OnChildAdded(card.SpriteRenderer); * });*/ card.KillAnimation(); card.MoveTo(GetPositionForChild(card.transform.GetSiblingIndex()), cardDropSpeed).OnComplete(() => { scrollableComponent.OnChildAdded(card.SpriteRenderer); }); }
//This is called when the cards are in the correct position, after a delay due to the animation private void OnCardsReady() { foreach (Transform previewCard in cardHolderTransform) { scrollableComponent.OnChildAdded(previewCard.GetComponent <SpriteRenderer>()); } scrollableComponent.InitButtons(); }