コード例 #1
0
        public List <DownRiseGrid> GetMovePath(DownRiseGrid varCur, DownRiseGrid varTarget)
        {
            int tempIndex01 = mRelationList1.IndexOf(varCur);
            int tempIndex02 = mRelationList1.IndexOf(varTarget);

            int tempIndex11 = mRelationList2.IndexOf(varCur);
            int tempIndex12 = mRelationList2.IndexOf(varTarget);

            if (tempIndex01 >= 0 && tempIndex02 >= 0)
            {
                return(GetMovePathOnGroup(tempIndex01, tempIndex02, mRelationList1));
            }
            else if (tempIndex11 >= 0 && tempIndex12 >= 0)
            {
                return(GetMovePathOnGroup(tempIndex11, tempIndex12, mRelationList2));
            }
            else
            {
                if (tempIndex01 >= 0 && tempIndex12 >= 0)
                {
                    List <DownRiseGrid> tempList = new List <DownRiseGrid>();
                    int tempIndex = tempIndex01;
                    while (tempIndex != 0)
                    {
                        tempIndex--;
                        tempList.Add(mRelationList1[tempIndex]);
                    }
                    while (tempIndex < tempIndex12)
                    {
                        tempIndex++;
                        tempList.Add(mRelationList2[tempIndex]);
                    }
                    return(tempList);
                }
                else if (tempIndex11 >= 0 && tempIndex02 >= 0)
                {
                    List <DownRiseGrid> tempList = new List <DownRiseGrid>();
                    int tempIndex = tempIndex11;
                    while (tempIndex != 0)
                    {
                        tempIndex--;
                        tempList.Add(mRelationList2[tempIndex]);
                    }
                    while (tempIndex < tempIndex02)
                    {
                        tempIndex++;
                        tempList.Add(mRelationList1[tempIndex]);
                    }
                    return(tempList);
                }
                return(null);
            }
        }
コード例 #2
0
        private void CatchHitObj(Transform varTrans)
        {
            var tempScript = varTrans.GetComponent <DownRiseGrid>();

            if (tempScript == null)
            {
                return;
            }
            List <DownRiseGrid> tempList = mPathConfig.GetMovePath(mCurrentGrid, tempScript);

            if (tempList == null || tempList.Count == 0)
            {
                return;
            }

            float    tempRemainTime = mJumpTotalTime - mJumpPrepateTime - mJumpTime - mUpGridTime;
            Sequence tempSeq        = DOTween.Sequence();

            for (int i = 0; i < tempList.Count; i++)
            {
                var   drg             = tempList[i];
                float tempDownOneTime = i * mJumpTotalTime + mJumpPrepateTime + mJumpTime - mDownGridTime;

                Vector3 tempGridPos = drg.transform.position;
                Vector3 tempPos     = tempGridPos;
                tempPos.y = mInitY;
                tempSeq.AppendCallback(
                    () => {
                    SetDirection(tempPos);
                    SwitchJumpState();
                }
                    ).
                AppendInterval(mJumpPrepateTime).Append(transform.DOJump(tempPos, 0.3f, 1, mJumpTime).OnComplete(() => { mCurrentGrid = drg; }))
                .Insert(tempDownOneTime, transform.DOMoveY(mInitY - 0.1f, mDownGridTime))
                .Insert(i * mJumpTotalTime + mJumpPrepateTime + mJumpTime, transform.DOMoveY(mInitY, mUpGridTime));
                if (tempRemainTime > 0)
                {
                    tempSeq.AppendInterval(tempRemainTime);
                }

                DOTween.Sequence().AppendInterval(tempDownOneTime)
                .Append(drg.transform.DOMoveY(tempGridPos.y - 0.1f, mDownGridTime))
                .Append(drg.transform.DOMoveY(tempGridPos.y, mUpGridTime)).Play().timeScale = 3f;
            }
            tempSeq.AppendCallback(StopJump).Play().timeScale = 3f;

            mIsMove = true;
        }