public void MoveCard(int cardIndex, CardHolder other, out TweenHolder outTween, bool?visibleDuringTween, int indexToInsertAt = -1) { CardController cardBeingMoved = _Cards[cardIndex]; _Cards.RemoveAt(cardIndex); if (!other._Cards.InsertionIndexIsValid(indexToInsertAt)) { indexToInsertAt = other._Cards.Count; } other.AddCard(cardBeingMoved, indexToInsertAt); cardBeingMoved.ViewFSM.SetAnimState(other._cardsAnimState, performTweens: false); cardBeingMoved.ViewFSM.SetTextVisibility(visibleDuringTween ?? other._cardsTextVisibility); outTween = cardBeingMoved.AddOffsetHeightTween(_cardAnimationData.GeneralCardMoveHeight, other.GetFinalPositionOfCardAtIndex(indexToInsertAt), true) .AddLocalRotationTween(Vector3.one * 360.0f + cardBeingMoved.ViewFSM.GetAnimRotationOffset()) .AddIncrementalScaleTween(cardBeingMoved.ViewFSM.GetAnimScale()) .SetDuration(_cardAnimationData.GeneralCardMoveDuration) .SetShouldChangeLayer(true) .AddToOnFinishedOnce(() => other.OnCardRecieveTweenFinished(cardBeingMoved)); OnCardSent(cardBeingMoved); other.OnCardRecieveTweenBegan(cardBeingMoved); if (CardFlipAudio != null) { CardFlipAudio.Play(); } }
public void IntroduceCard(CardController cardToIntroduce, out TweenHolder outTween, bool fancyEntrance = false, float angleOffsetForFancyEntrance = 0.0f) { outTween = null; AddCard(cardToIntroduce); cardToIntroduce.ViewFSM.SetAnimState(_cardsAnimState, performTweens: false); if (fancyEntrance) { float cardCreationRadius = _cardAnimationData.DeckFillFancyIntroCardSpawnDistance; float rightDistance = cardCreationRadius * Mathf.Cos(angleOffsetForFancyEntrance); float forwardDistance = cardCreationRadius * Mathf.Sin(angleOffsetForFancyEntrance); cardToIntroduce.transform.position = transform.position + Vector3.right * rightDistance + Vector3.forward * forwardDistance; outTween = cardToIntroduce.AddOffsetHeightTween(_cardAnimationData.DeckFillFancyIntroTweenHeight, GetCardPositionAtIndex(_Cards.LastIndex()), true) .AddLocalRotationTween(360.0f * Vector3.one + cardToIntroduce.ViewFSM.GetAnimRotationOffset()) .SetDuration(_cardAnimationData.DeckFillDurationPerCard) .SetShouldChangeLayer(true) .AddToOnFinishedOnce(() => OnCardRecieveTweenFinished(cardToIntroduce)); OnCardRecieveTweenBegan(cardToIntroduce); } else { cardToIntroduce.transform.ResetLocal(); } if (CardFlipAudio != null) { CardFlipAudio.Play(); } }