Exemplo n.º 1
0
    /// <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();
        });
    }
Exemplo n.º 2
0
    private IEnumerator createJigsaw()
    {
        while (isCreateJigsaw)
        {
            Texture2D  texture2D  = Texture2D.blackTexture;
            JigsawBean jigsawBean = CreateJigsawDataUtils.createJigsaw(JigsawStyleEnum.Def, 1f, 1f, texture2D);

            GameObject jigsawObj     = JigsawObjBuilder.buildJigsawGameObj(jigsawBean, texture2D);
            float      startX        = DevUtil.getRandomFloat(-(int)(DevUtil.GetScreenWith() / 2f), (int)(DevUtil.GetScreenWith() / 2f));
            float      startY        = DevUtil.GetScreenHeight() / 2f;
            float      endX          = DevUtil.getRandomFloat(-(int)(DevUtil.GetScreenWith() / 2f), (int)(DevUtil.GetScreenWith() / 2f));
            float      endY          = -DevUtil.GetScreenHeight() / 2f;
            Vector3    startPosition = new Vector3(startX, startY, 2);
            jigsawObj.transform.position = startPosition;
            jigsawObj.transform.DOMove(new Vector3(endX, endY, 2), 10);
            yield return(new WaitForSeconds(1f));
        }
    }