/// <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 closureAnim() { 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 .DOMove(startPosition, closeureTime) .SetDelay(mPrependTime + animOffsetTime * i); if (i.Equals(listCount - 1)) { tweener.OnComplete(dispersedAnim); } } }
/// <summary> /// 创建漏斗 /// </summary> private void buildFunnel() { int listCount = mListObj.Count; for (int i = 0; i < listCount; i++) { GameObject itemObj = mListObj[i]; //设置层级 JigsawContainerCpt containerCpt = itemObj.GetComponent <JigsawContainerCpt>(); if (containerCpt == null) { continue; } containerCpt.setSortingOrder(listCount - i); float picW = mGameStartControl.picAllWith; float picH = mGameStartControl.picAllHigh; float moveX = DevUtil.getRandomFloat(-picW / 2f, picW / 2f); float rangY = (picH / 2f) / ((picW / 2f) / ((picW / 2f) - (Mathf.Abs(moveX)))); float moveY = DevUtil.getRandomFloat((picH / 2f) - rangY, picH / 2f); itemObj .transform .DOMove(new Vector3(moveX, moveY), mBuildFunnelTime) .SetDelay(mPrependTime); } mGameStartControl.transform .DOScale(new Vector3(1, 1, 1), mPrependTime + mBuildFunnelTime) .OnComplete(delegate() { moveToMouth(); }); }
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 decomposeAnim() { if (mListObj == null) { return; } int listCount = mListObj.Count; float radius = 0; if (mGameStartControl == null) { return; } 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; //设置层级 JigsawContainerCpt containerCpt = itemTF.GetComponent <JigsawContainerCpt>(); if (containerCpt == null) { continue; } containerCpt.setSortingOrder(listCount - i); //设置动画 Tweener tweener = itemTF .DOMove(listCircleVec[i], moveTime) .SetDelay(mPrependTime); if (i.Equals(listCount - 1)) { tweener.OnComplete(rotateAnim); } } }
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(); }); }