Esempio n. 1
0
        protected void UpdateTween(RectTransform p_target, float p_delta, NodeFlowData p_flowData, Vector2 p_startPosition, Quaternion p_startRotation, Vector3 p_startScale, RectTransform p_towards, EaseType p_easeType)
        {
            if (p_target == null)
            {
                if (Model.killOnNullEncounter)
                {
                    Stop_Internal();
                }
                return;
            }

            if (Model.useToPosition)
            {
                Vector2 towardsPosition = TransformExtensions.FromToRectTransform(p_towards, p_target);
                //towardsPosition = towardsPosition - p_target.anchoredPosition;

                towardsPosition = new Vector2(DashTween.EaseValue(p_startPosition.x, towardsPosition.x, p_delta, p_easeType),
                                              DashTween.EaseValue(p_startPosition.y, towardsPosition.y, p_delta, p_easeType));

                p_target.anchoredPosition = towardsPosition;
            }

            if (Model.useToRotation)
            {
                p_target.localRotation = Quaternion.Lerp(p_startRotation, p_towards.localRotation, p_delta);
            }

            if (Model.useToScale)
            {
                p_target.localScale = Vector3.Lerp(p_startScale, p_towards.localScale, p_delta);
            }
        }
Esempio n. 2
0
        protected void UpdateScaleTween(Transform p_target, float p_delta, NodeFlowData p_flowData, Vector3 p_startScale, Vector3 p_toScale, bool p_relative, EaseType p_easeType)
        {
            if (p_target == null)
            {
                if (Model.killOnNullEncounter)
                {
                    Stop_Internal();
                }
                return;
            }

            if (p_relative)
            {
                p_target.localScale = p_startScale + new Vector3(DashTween.EaseValue(0, p_toScale.x, p_delta, p_easeType),
                                                                 DashTween.EaseValue(0, p_toScale.y, p_delta, p_easeType),
                                                                 DashTween.EaseValue(0, p_toScale.z, p_delta, p_easeType));
            }
            else
            {
                p_toScale          -= p_startScale;
                p_target.localScale = p_startScale + new Vector3(DashTween.EaseValue(0, p_toScale.x, p_delta, p_easeType),
                                                                 DashTween.EaseValue(0, p_toScale.y, p_delta, p_easeType),
                                                                 DashTween.EaseValue(0, p_toScale.z, p_delta, p_easeType));
            }
        }
Esempio n. 3
0
        protected void UpdatePositionTween(Transform p_target, float p_delta, NodeFlowData p_flowData, Vector3 p_startPosition, Vector3 p_finalPosition, bool p_relative, EaseType p_easeType)
        {
            if (p_target == null)
            {
                if (Model.killOnNullEncounter)
                {
                    Stop_Internal();
                }
                return;
            }

            if (p_relative)
            {
                p_target.position =
                    p_startPosition + new Vector3(DashTween.EaseValue(0, p_finalPosition.x, p_delta, p_easeType),
                                                  DashTween.EaseValue(0, p_finalPosition.y, p_delta, p_easeType),
                                                  DashTween.EaseValue(0, p_finalPosition.z, p_delta, p_easeType));
            }
            else
            {
                p_target.position = new Vector3(DashTween.EaseValue(p_startPosition.x, p_finalPosition.x, p_delta, p_easeType),
                                                DashTween.EaseValue(p_startPosition.y, p_finalPosition.y, p_delta, p_easeType),
                                                DashTween.EaseValue(p_startPosition.z, p_finalPosition.z, p_delta, p_easeType));
            }
        }
Esempio n. 4
0
        protected void UpdateTransformTween(Transform p_target, float p_delta, NodeFlowData p_flowData, Vector2 p_startPosition, Quaternion p_startRotation, Vector3 p_startScale, Transform p_towards, EaseType p_easeType)
        {
            if (p_target == null)
            {
                if (Model.killOnNullEncounter)
                {
                    Stop_Internal();
                }

                return;
            }

            if (GetParameterValue(Model.useToPosition, p_flowData))
            {
                Vector2 towardsPosition = p_towards.position;

                towardsPosition = new Vector2(DashTween.EaseValue(p_startPosition.x, towardsPosition.x, p_delta, p_easeType),
                                              DashTween.EaseValue(p_startPosition.y, towardsPosition.y, p_delta, p_easeType));

                p_target.position = towardsPosition;
            }

            if (GetParameterValue(Model.useToRotation, p_flowData))
            {
                p_target.localRotation = Quaternion.Lerp(p_startRotation, p_towards.localRotation, p_delta);
            }

            if (GetParameterValue(Model.useToScale, p_flowData))
            {
                p_target.localScale = Vector3.Lerp(p_startScale, p_towards.localScale, p_delta);
            }
        }
Esempio n. 5
0
        protected void UpdateTween(Transform p_target, float p_delta, NodeFlowData p_flowData, Quaternion p_startRotation, Vector3 p_toRotation, EaseType p_easeType)
        {
            if (p_target == null)
            {
                if (Model.killOnNullEncounter)
                {
                    Stop_Internal();
                }
                return;
            }

            Quaternion rotation = Quaternion.Euler(p_toRotation);

            if (Model.isToRelative)
            {
                rotation = rotation * p_startRotation;
            }
            //p_target.localRotation = Quaternion.Lerp(p_startRotation, rotation, DOVirtual.EasedValue(0,1, p_delta, p_easing));
            p_target.localRotation = Quaternion.Lerp(p_startRotation, rotation, DashTween.EaseValue(0, 1, p_delta, p_easeType));

            /*
             * Debug.Log(rotation.eulerAngles + " : " + p_toRotation + " : " + p_startRotation.eulerAngles);
             * Vector3 finalRotation = rotation.eulerAngles;
             * finalRotation.z = finalRotation.z > 180 ? finalRotation.z - 360 : finalRotation.z;
             * Vector3 easedRotation = new Vector3(DOVirtual.EasedValue(0, finalRotation.x, p_delta, Model.easing),
             *  DOVirtual.EasedValue(0, finalRotation.y, p_delta, Model.easing),
             *  DOVirtual.EasedValue(0, finalRotation.z, p_delta, Model.easing));
             *
             * p_target.localRotation = p_startRotation * Quaternion.Euler(easedRotation);
             */
        }
Esempio n. 6
0
        protected void UpdateRotationTween(Transform p_target, float p_delta, NodeFlowData p_flowData, Quaternion p_startRotation, Vector3 p_toRotation, bool p_relative, EaseType p_easeType)
        {
            if (p_target == null)
            {
                if (Model.killOnNullEncounter)
                {
                    Stop_Internal();
                }
                return;
            }

            Quaternion rotation = Quaternion.Euler(p_toRotation);

            if (p_relative)
            {
                rotation = rotation * p_startRotation;
            }
            p_target.localRotation = Quaternion.Lerp(p_startRotation, rotation, DashTween.EaseValue(0, 1, p_delta, p_easeType));
        }
Esempio n. 7
0
        protected void UpdateTween(CanvasGroup p_target, float p_delta, NodeFlowData p_flowData, float p_startAlpha, float p_toAlpha, EaseType p_easeType)
        {
            ;
            // Check if the target wasn't destroyed while the tween is running, correctly end user should also destroy all tweens explicitly
            if (p_target == null)
            {
                if (Model.killOnNullEncounter)
                {
                    Stop_Internal();
                }
                return;
            }

            if (Model.isToRelative)
            {
                p_target.alpha = p_startAlpha + DashTween.EaseValue(0, p_toAlpha, p_delta, p_easeType);
            }
            else
            {
                p_target.alpha = DashTween.EaseValue(p_startAlpha, p_toAlpha, p_delta, p_easeType);
            }
        }
Esempio n. 8
0
        protected void UpdateTween(RectTransform p_target, float p_delta, NodeFlowData p_flowData, Vector2 p_startSizeDelta, Vector2 p_toSizeDelta, EaseType p_easeType)
        {
            if (p_target == null)
            {
                if (Model.killOnNullEncounter)
                {
                    Stop_Internal();
                }
                return;
            }

            if (Model.isToRelative)
            {
                p_target.sizeDelta =
                    p_startSizeDelta + new Vector2(DashTween.EaseValue(0, p_toSizeDelta.x, p_delta, p_easeType),
                                                   DashTween.EaseValue(0, p_toSizeDelta.y, p_delta, p_easeType));
            }
            else
            {
                p_target.sizeDelta = new Vector2(DashTween.EaseValue(p_startSizeDelta.x, p_toSizeDelta.x, p_delta, p_easeType),
                                                 DashTween.EaseValue(p_startSizeDelta.y, p_toSizeDelta.y, p_delta, p_easeType));
            }
        }
Esempio n. 9
0
        protected void UpdateTween(RectTransform p_target, float p_delta, NodeFlowData p_flowData, Vector2 p_startPosition, Vector2 p_finalPosition, EaseType p_easeType)
        {
            if (p_target == null)
            {
                if (Model.killOnNullEncounter)
                {
                    Stop_Internal();
                }
                return;
            }

            if (Model.isToRelative)
            {
                p_target.anchoredPosition =
                    p_startPosition + new Vector2(DashTween.EaseValue(0, p_finalPosition.x, p_delta, p_easeType),
                                                  DashTween.EaseValue(0, p_finalPosition.y, p_delta, p_easeType));
            }
            else
            {
                p_target.anchoredPosition = new Vector2(DashTween.EaseValue(p_startPosition.x, p_finalPosition.x, p_delta, p_easeType),
                                                        DashTween.EaseValue(p_startPosition.y, p_finalPosition.y, p_delta, p_easeType));
            }
        }