/// <summary> /// 分散动画 /// </summary> private void dispersedAnim() { int listCount = mListObj.Count; for (int i = 0; i < listCount; i++) { GameObject itemObj = mListObj[i]; Transform itemTF = itemObj.transform; //设置动画 Tweener tweener = itemTF .DOMove(startPosition, dispersedOffsetTime) .SetDelay(animOffsetTime * i) .OnComplete(delegate() { GameStartAnimationManager.PuzzlesStartPre(itemObj); }); } Tweener gameStartTweener = mGameStartControl.transform .DOScale(new Vector3(1, 1, 1), dispersedOffsetTime + listCount * animOffsetTime) .OnComplete(delegate() { mGameStartControl.gameStart(); }); }
/// <summary> /// 分散动画 /// </summary> private void dispersedAnim() { int listCount = mListObj.Count; for (int i = 0; i < listCount; i++) { GameObject itemObj = mListObj[i]; Transform itemTF = itemObj.transform; //设置层级 JigsawContainerCpt containerCpt = itemTF.GetComponent <JigsawContainerCpt>(); if (containerCpt == null) { continue; } containerCpt.setSortingOrder(listCount - i); //设置动画 Tweener tweener = itemTF .DOScale(new Vector3(1, 1, 1), animOffsetTime * i) .SetDelay(mPrependTime) .OnComplete(delegate() { GameStartAnimationManager.PuzzlesStartPre(itemObj); }); } Tweener gameStartTweener = mGameStartControl.transform .DOScale(new Vector3(1, 1, 1), mPrependTime + listCount * animOffsetTime) .OnComplete(delegate() { mGameStartControl.gameStart(); }); }
/// <summary> /// 移动到发射口 /// </summary> private void moveToMouth() { int listCount = mListObj.Count; for (int i = 0; i < listCount; i++) { GameObject itemObj = mListObj[i]; itemObj .transform .DOMove(new Vector3(0, 0), mMoveToMouthTime) .SetDelay(mLaunchOffTime * i) .OnComplete(delegate() { int xF = DevUtil.getRandomInt(-10, 10); int yF = DevUtil.getRandomInt(-100, -10); GameStartAnimationManager.PuzzlesStartPre(itemObj, xF, yF); }); } mGameStartControl.transform .DOScale(new Vector3(1, 1, 1), mLaunchOffTime * listCount + mMoveToMouthTime) .OnComplete(delegate() { mGameStartControl.gameStart(); }); }
public override void startAnim() { float radius = 0; if (mGameStartControl.picAllWith > mGameStartControl.picAllHigh) { radius = mGameStartControl.picAllHigh; } else { radius = mGameStartControl.picAllWith; } int listCount = mListObj.Count; List <Vector3> listCircleVec = GeometryUtil.getCircleVertices(mStartPosition, radius * 1.9f, listCount, true, CircleStartVectorEnum.Left); int circleCount = listCircleVec.Count; for (int i = 0; i < listCount; i++) { GameObject itemObj = mListObj[i]; //设置层级 JigsawContainerCpt containerCpt = itemObj.transform.GetComponent <JigsawContainerCpt>(); if (containerCpt == null) { continue; } containerCpt.setSortingOrder(listCount - i); // int mListMoveCount= DevUtil.getRandomInt(1, circleCount); Vector3[] listMove = new Vector3[mListMoveCount]; for (int f = 0; f < mListMoveCount; f++) { int randomPosition = DevUtil.getRandomInt(0, circleCount - 1); listMove[f] = listCircleVec[randomPosition]; } //开始run itemObj.transform .DOPath(listMove, mRunTime) .SetDelay(mPrependTime) .OnComplete(delegate() { GameStartAnimationManager.PuzzlesStartPre(itemObj); }); } Tweener gameStartTweener = mGameStartControl.transform .DOScale(new Vector3(1, 1, 1), mPrependTime + mRunTime) .OnComplete(delegate() { mGameStartControl.gameStart(); }); }
private void changeAnim() { int listCount = mListObj.Count; List <Vector3> otherListPosition = new List <Vector3>(); for (int i = 0; i < listCount; i++) { otherListPosition.Add(mListObj[i].transform.position); } for (int i = 0; i < listCount; i++) { GameObject itemObj = mListObj[i]; Transform itemTF = itemObj.transform; //设置层级 JigsawContainerCpt containerCpt = itemTF.GetComponent <JigsawContainerCpt>(); if (containerCpt == null) { continue; } containerCpt.setSortingOrder(listCount - i); int changeRandom = DevUtil.getRandomInt(0, otherListPosition.Count - 1); Vector3 changePosition = otherListPosition[changeRandom]; itemTF .DOMove(changePosition, changeTime) .SetDelay(mPrependTime) .OnComplete(delegate() { GameStartAnimationManager.PuzzlesStartPre(itemObj); }); otherListPosition.Remove(changePosition); } Tweener gameStartTweener = mGameStartControl.transform .DOScale(new Vector3(1, 1, 1), changeTime + mPrependTime) .OnComplete(delegate() { mGameStartControl.gameStart(); }); }
/// <summary> /// 旋转动画 /// </summary> private void rotateAnim() { int listCount = mListObj.Count; float radius = 0; if (mGameStartControl.picAllWith > mGameStartControl.picAllHigh) { radius = mGameStartControl.picAllHigh; } else { radius = mGameStartControl.picAllWith; } List <Vector3> listCircleVec = GeometryUtil.getCircleVertices(startPosition, radius * 1.9f, listCount, true, CircleStartVectorEnum.Left); for (int i = 0; i < listCount; i++) { GameObject itemObj = mListObj[i]; Transform itemTF = itemObj.transform; Vector3[] arrayCircleVec = DevUtil.listToArrayFormPosition(listCircleVec, i); itemTF.DOPath(arrayCircleVec, roatateTime).OnComplete(delegate() { GameStartAnimationManager.PuzzlesStartPre(itemObj); }); } Tweener gameStartTweener = mGameStartControl .transform .DOScale(new Vector3(1, 1, 1), roatateTime) .OnComplete(delegate() { mGameStartControl.gameStart(); }); }
/// <summary> /// 开始动画 /// </summary> private void startAnim() { GameStartAnimationManager.StartAnimation(this, containerList); }