Exemplo n.º 1
0
        private void OnEffect(ElimlnateGrid target, TweenEffectBase <GridEffectParam> tw, GridEffectParam param)
        {
            if (param.IsInited)
            {
                GridCreater    gridsCreate = ElimlnateCore.Instance.GridCreater;
                AnimationCurve curve       = gridsCreate.EnterEffectCurve;

                int   gridID     = target.GridID;
                float start      = mStartPos[gridID];
                float end        = mEndDistance[gridID];
                float time       = mCurveTime[gridID];
                float curveValue = curve.Evaluate(time / param.DuringTime);

                Vector3 pos        = target.GridTrans.position;
                bool    isFinished = curveValue >= 1f;
                if (isFinished)
                {
                    mStartPos.Remove(gridID);
                    mEndDistance.Remove(gridID);
                    mCurveTime.Remove(gridID);

                    pos.Set(pos.x, end, pos.z);
                }
                else
                {
                    pos.Set(pos.x, end * curveValue, pos.z);

                    time += Time.deltaTime;
                    mCurveTime[gridID] = time;
                }

                target.GridTrans.position = pos;

                if (isFinished)
                {
                    OnEffectCompleted();
                }
                else
                {
                }
            }
            else
            {
                EffectCount++;

                tw.ResetTweenRefs();

                float start    = target.GridTrans.position.y;
                float endValue = start + EndValueOffset;
                mStartPos[target.GridID]    = start;
                mEndDistance[target.GridID] = endValue;
                mCurveTime[target.GridID]   = 0f;
            }
        }
Exemplo n.º 2
0
        protected virtual void OnEffect(ElimlnateGrid target, TweenEffectBase <GridEffectParam> tw, GridEffectParam param)
        {
            tw.ResetTweenRefs();

            Sequence seq = DOTween.Sequence();

            seq.Append(target.GridTrans.DOScale(mScale_1, 0.1f));
            seq.Append(target.GridTrans.DOScale(mScale_2, 0.1f));

            tw.TweenRef = new Tween[] { seq };
        }