コード例 #1
0
        private IEnumerator Appearing()
        {
            float _time             = 0f;
            bool  _customCurveSpeed = itemAnimationData.animationData.speedAppearing.curveTypeIndex == 0;
            bool  _customCurveScale = itemAnimationData.animationData.scaleAppearing.curveTypeIndex == 0;

            CalculationEasing.Function _functionSpeed = CalculationEasing.GetEasingFunction(Ease.Linear);
            CalculationEasing.Function _functionScale = CalculationEasing.GetEasingFunction(Ease.Linear);

            if (_customCurveSpeed == false)
            {
                _functionSpeed = CalculationEasing.GetEasingFunction((Ease)itemAnimationData.animationData.speedAppearing.curveTypeIndex - 1);
            }

            if (_customCurveScale == false)
            {
                _functionScale = CalculationEasing.GetEasingFunction((Ease)itemAnimationData.animationData.scaleAppearing.curveTypeIndex - 1);
            }

            while (_time < itemAnimationData.animationData.delayAppearing)
            {
                if (itemAnimationData.animationData.speedAppearing.useCurve)
                {
                    if (_customCurveSpeed)
                    {
                        transform.position = CalculateVectorInterpolationCustom(itemAnimationData.animationData.speedAppearing.curve,
                                                                                itemAnimationData.animationData.speedAppearing.reversed,
                                                                                fromPosition, toPosition, _time / itemAnimationData.animationData.delayAppearing);
                    }
                    else
                    {
                        transform.position = CalculateVectorInterpolation(_functionSpeed,
                                                                          itemAnimationData.animationData.speedAppearing.reversed, fromPosition, toPosition,
                                                                          _time / itemAnimationData.animationData.delayAppearing);
                    }
                }


                if (itemAnimationData.animationData.scaleAppearing.useCurve)
                {
                    if (_customCurveScale)
                    {
                        transform.localScale = CalculateVectorInterpolationCustom(itemAnimationData.animationData.scaleAppearing.curve,
                                                                                  itemAnimationData.animationData.scaleAppearing.reversed,
                                                                                  itemAnimationData.animationData.startScaleAppearing, itemAnimationData.animationData.endScaleAppearing,
                                                                                  _time / itemAnimationData.animationData.delayAppearing);
                    }
                    else
                    {
                        transform.localScale = CalculateVectorInterpolation(_functionScale,
                                                                            itemAnimationData.animationData.scaleAppearing.reversed, itemAnimationData.animationData.startScaleAppearing,
                                                                            itemAnimationData.animationData.endScaleAppearing, _time / itemAnimationData.animationData.delayAppearing);
                    }
                }


                _time += Time.deltaTime;
                yield return(new WaitForSeconds(Time.deltaTime));
            }

            if (itemAnimationData.animationData.speedAppearing.useCurve)
            {
                rectTransform.position = toPosition;
                fromPosition           = toPosition;
            }

            if (itemAnimationData.animationData.scaleAppearing.useCurve)
            {
                transform.localScale = itemAnimationData.animationData.endScaleAppearing;
            }

            ItemParticlesAnimator.Instance.OneItemAppearingCompleted(this);
        }
コード例 #2
0
        private IEnumerator Grouping()
        {
            float _time = 0;

            bool _customCurveSpeed = itemAnimationData.animationData.speedGrouping.curveTypeIndex == 0;
            bool _customCurveScale = itemAnimationData.animationData.scaleGrouping.curveTypeIndex == 0;

            CalculationEasing.Function _functionSpeed = CalculationEasing.GetEasingFunction((Ease)itemAnimationData.animationData.speedGrouping.curveTypeIndex - 1);
            CalculationEasing.Function _functionScale = CalculationEasing.GetEasingFunction((Ease)itemAnimationData.animationData.scaleGrouping.curveTypeIndex - 1);

            Vector3 _scaleStart = transform.localScale;
            Vector3 _position;

            while (_time < itemAnimationData.animationData.delayGrouping)
            {
                if (itemAnimationData.animationData.speedGrouping.useCurve)
                {
                    if (_customCurveSpeed)
                    {
                        _position = CalculateVectorInterpolationCustom(itemAnimationData.animationData.speedGrouping.curve,
                                                                       itemAnimationData.animationData.speedGrouping.reversed,
                                                                       fromPosition, toPosition, _time / itemAnimationData.animationData.delayGrouping);
                    }
                    else
                    {
                        _position = CalculateVectorInterpolation(_functionSpeed,
                                                                 itemAnimationData.animationData.speedGrouping.reversed, fromPosition, toPosition,
                                                                 _time / itemAnimationData.animationData.delayGrouping);
                    }


                    transform.position = _position;
                }


                if (itemAnimationData.animationData.scaleGrouping.useCurve)
                {
                    if (_customCurveScale)
                    {
                        transform.localScale = CalculateVectorInterpolationCustom(itemAnimationData.animationData.scaleGrouping.curve,
                                                                                  itemAnimationData.animationData.scaleGrouping.reversed,
                                                                                  _scaleStart, itemAnimationData.animationData.endScaleGrouping,
                                                                                  _time / itemAnimationData.animationData.delayGrouping);
                    }
                    else
                    {
                        transform.localScale = CalculateVectorInterpolation(_functionScale,
                                                                            itemAnimationData.animationData.scaleGrouping.reversed, _scaleStart,
                                                                            itemAnimationData.animationData.endScaleGrouping, _time / itemAnimationData.animationData.delayGrouping);
                    }
                }


                _time += Time.deltaTime;
                yield return(new WaitForSeconds(Time.deltaTime));
            }

            if (itemAnimationData.animationData.speedGrouping.useCurve)
            {
                rectTransform.position = toPosition;
                fromPosition           = toPosition;
            }

            if (itemAnimationData.animationData.scaleGrouping.useCurve)
            {
                transform.localScale = itemAnimationData.animationData.endScaleGrouping;
            }

            ItemParticlesAnimator.Instance.OneItemGroupingCompleted(this);

            //ItemParticlesAnimator.Instance.BecomeReady(this);
        }