Exemple #1
0
 public void InitGridCreater(Vector2 cellSize, float enterEffectTime, AnimationCurve curve, GameObject tileResRaw, Func <int, int> onGetGridTypeDuringCreate = default)
 {
     GridCreater = new GridCreater()
     {
         CellSize = cellSize,
         EnterEffectDuringTime   = enterEffectTime,
         EnterEffectCurve        = curve,
         TileResRaw              = tileResRaw,
         GetGridTypeDuringCreate = onGetGridTypeDuringCreate,
     };
 }
        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;
            }
        }
Exemple #3
0
        protected override IEffectInfo <ElimlnateGrid, GridEffectParam> Create(ref ElimlnateGrid target)
        {
            TweenEffect tween = new TweenEffect
            {
                EffectMethod = OnEffect,
                //ApplyUpdate = true,
            };
            GridCreater creater = ElimlnateCore.Instance.GridCreater;

            tween.Param.DuringTime = creater.EnterEffectDuringTime;
            tween.Param.Curve      = creater.EnterEffectCurve;
            return(tween);
        }
Exemple #4
0
        public void Clean()
        {
            IsClear = true;

            BoardGrids?.Clean();
            GridCreater?.Clean();
            GridOperater?.Clean();
            LineInputer?.Clean();
            GridTypes?.Clean();
            GridEffects?.Clean();
            mAutoActiveTimes?.Clear();
            mActiveTimeRemains?.Clear();

            OnUpdate        = default;
            GridsContainer  = default;
            DestroyGrid     = default;
            ElimlnateCamera = default;
            Inputer         = default;
        }