Пример #1
0
    private void AnimateShuffle(CardController card, int cardIndex)
    {
        float   animationDuration = UnityEngine.Random.Range(2.0f, _CardAnimationData.DeckShuffleExplosionDuration / 2.0f);
        Vector3 rotationVector    = (Mathf.Round(UnityEngine.Random.Range(1.0f, _CardAnimationData.DeckShuffleExplosionMaxRotations / 2.0f)) * 2.0f + 1.0f) * 360.0f * Vector3.one;

        rotationVector.z -= card.ViewFSM.GetAnimRotationOffset().z;
        card.AddPositionPingPongTween(card.gameObject.transform.position + Vector3.up * _CardAnimationData.DeckShuffleExplosionSphereRadius
                                      + UnityEngine.Random.onUnitSphere * UnityEngine.Random.Range(0.1f, Mathf.Max(1.0f, _CardAnimationData.DeckShuffleExplosionSphereRadius)),
                                      GetCardPositionAtIndex(cardIndex))
        .SetDuration(animationDuration)
        .SetDelay(UnityEngine.Random.Range(0.0f, _CardAnimationData.DeckShuffleExplosionDuration - animationDuration))
        .AddLocalRotationTween(rotationVector, true)
        .SetShouldChangeLayer(true)
        .AddToOnFinishedOnce(() => OnCardRecieveTweenFinished(card));
    }