public static Sequence ZoomSlamTween(
        BaseCardView ingredient,
        BaseCardView customer,
        bool shouldMoveTween,
        TweenCallback slamCallback,
        TweenCallback finishCallback)
    {
        Vector3 originalScale = ingredient.transform.localScale;

        if (shouldMoveTween)
        {
        }
        Vector3  cardEyeVec  = (Camera.main.transform.position - customer.transform.position).normalized;
        Sequence sequence    = DOTween.Sequence();
        Tween    moveToTween = null;

        if (shouldMoveTween)
        {
            moveToTween = ingredient.transform.DOMove(customer.transform.position + cardEyeVec, 0.27f);
            moveToTween.SetEase(Ease.OutCubic);
        }

        Tween growTween = ingredient.transform.DOScale(originalScale * 1.3f, 0.31f);

        growTween.SetEase(Ease.OutCubic);

        Tween slamTween = ingredient.transform.DOScale(originalScale * 0.1f, 0.2f);

        slamTween.SetEase(Ease.InCubic);

        Sequence shakeSeq      = DOTween.Sequence();
        Tween    shakePosTween = customer.transform.DOShakePosition(0.4f, 10.0f, 22);

        shakePosTween.SetEase(Ease.OutCubic);
        Tween shakeRotTween = customer.transform.DOShakeRotation(0.4f, 6.0f, 16);

        shakeRotTween.SetEase(Ease.OutCubic);
        shakeSeq.Insert(0.0f, shakePosTween);
        shakeSeq.Insert(0.0f, shakeRotTween);
        if (shouldMoveTween)
        {
            sequence.Insert(0.0f, moveToTween);
        }
        sequence.Insert(0.0f, growTween);
        sequence.Append(slamTween);

        if (slamCallback != null)
        {
            sequence.AppendCallback(slamCallback);
        }

        sequence.Append(shakeSeq);

        if (finishCallback != null)
        {
            sequence.OnComplete(finishCallback);
        }
        return(sequence);
    }
Beispiel #2
0
    public BaseCardView CreateCardView(BaseCardData cardData, Transform cParent)
    {
        BaseCardView prefab = (cardData.cardType == CardType.CUSTOMER) ?
                              customerCardView : ingredientCardView;

        BaseCardView view = Instantiate <BaseCardView>(prefab, cParent, false);

        view.cardData = cardData;

        return(view);
    }