Example #1
0
    public void PlayAnimation(TransformAnimationComponent target)
    {
        OnStart?.Invoke();
        Coroutiner.Wait(_waitDuration, () => OnComplete?.Invoke());

        if (move.Enabled)
        {
            target.transform.DOMove(startPosition + move.By, move.duration).SetEase(move.ease);
        }
        if (rotate.Enabled)
        {
            target.transform.DORotate(startRotation + rotate.By, rotate.duration).SetEase(rotate.ease);
        }
        if (scale.Enabled)
        {
            target.transform.DOScale(startScale + scale.By, scale.duration).SetEase(scale.ease);
        }

        PlayAnimatedProperty(animatedProperty);
        PlayAnimatedProperty(animatedProperty2);
        PlayAnimatedProperty(animatedProperty3);
    }
Example #2
0
    public void PlayAnimation(UIComponent component)
    {
        if (!Enabled)
        {
            return;
        }
        if (_currentAnimation != null)
        {
            Coroutiner.KillCoroutine(_currentAnimation);
        }
        OnStart?.Invoke();
        _currentAnimation = Coroutiner.Wait(_waitDuration, () => OnComplete?.Invoke());


        if (scale.Enabled)
        {
            switch (scale.AnimationType)
            {
            case AnimationType.Punch:
                ROJOAnimator.StopAnimation(component.RectTransform, AnimationType.Punch, AnimationAction.Scale);
                ROJOAnimator.ScalePunch(component.RectTransform, scale, component.StartScale);
                break;

            case AnimationType.State:
                ROJOAnimator.StopAnimation(component.RectTransform, AnimationType.State, AnimationAction.Scale);
                ROJOAnimator.ScaleState(component.RectTransform, scale, component.StartScale);
                break;

            default:
                break;
            }
        }

        if (move.Enabled)
        {
            switch (move.AnimationType)
            {
            case AnimationType.Punch:
                ROJOAnimator.StopAnimation(component.RectTransform, AnimationType.Punch, AnimationAction.Move);
                ROJOAnimator.MovePunch(component.RectTransform, move, component.StartPosition);
                break;

            case AnimationType.State:
                ROJOAnimator.StopAnimation(component.RectTransform, AnimationType.State, AnimationAction.Move);
                ROJOAnimator.MoveState(component.RectTransform, move, component.StartPosition);
                break;

            default:
                break;
            }
        }

        if (rotate.Enabled)
        {
            switch (rotate.AnimationType)
            {
            case AnimationType.Punch:
                ROJOAnimator.StopAnimation(component.RectTransform, AnimationType.Punch, AnimationAction.Rotate);
                ROJOAnimator.RotatePunch(component.RectTransform, rotate, component.StartRotation);
                break;

            case AnimationType.State:
                ROJOAnimator.StopAnimation(component.RectTransform, AnimationType.State, AnimationAction.Rotate);
                ROJOAnimator.RotateState(component.RectTransform, rotate, component.StartRotation);
                break;

            default:
                break;
            }
        }

        if (animatedProperty.Enabled)
        {
            switch (animatedProperty.property.AnimationType)
            {
            case AnimationType.Punch:
                ROJOAnimator.StopAnimation(component.material, AnimationType.Punch, AnimationAction.Property);
                ROJOAnimator.PropertyPunch(component.material, animatedProperty);
                break;

            case AnimationType.State:
                ROJOAnimator.StopAnimation(component.material, AnimationType.State, AnimationAction.Property);
                ROJOAnimator.PropertyState(component.material, animatedProperty);
                break;

            default:
                break;
            }
        }
    }