当前位置: 首页>>代码示例>>C#>>正文


C# LTDescr.resume方法代码示例

本文整理汇总了C#中LTDescr.resume方法的典型用法代码示例。如果您正苦于以下问题:C# LTDescr.resume方法的具体用法?C# LTDescr.resume怎么用?C# LTDescr.resume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LTDescr的用法示例。


在下文中一共展示了LTDescr.resume方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: timeBasedTesting

    IEnumerator timeBasedTesting()
    {
        yield return new WaitForSeconds(1);

        yield return new WaitForEndOfFrame();

        LeanTest.expect( Mathf.Abs( timeElapsedNormalTimeScale - timeElapsedIgnoreTimeScale ) < 0.15f, "START IGNORE TIMING", "timeElapsedIgnoreTimeScale:"+timeElapsedIgnoreTimeScale+" timeElapsedNormalTimeScale:"+timeElapsedNormalTimeScale );

        Time.timeScale = 4f;

        int pauseCount = 0;
        LeanTween.value( gameObject, 0f, 1f, 1f).setOnUpdate( ( float val )=>{
            pauseCount++;
        }).pause();

        // Bezier should end at exact end position not just 99% close to it
        Vector3[] roundCirc = new Vector3[]{ new Vector3(0f,0f,0f), new Vector3(-9.1f,25.1f,0f), new Vector3(-1.2f,15.9f,0f), new Vector3(-25f,25f,0f), new Vector3(-25f,25f,0f), new Vector3(-50.1f,15.9f,0f), new Vector3(-40.9f,25.1f,0f), new Vector3(-50f,0f,0f), new Vector3(-50f,0f,0f), new Vector3(-40.9f,-25.1f,0f), new Vector3(-50.1f,-15.9f,0f), new Vector3(-25f,-25f,0f), new Vector3(-25f,-25f,0f), new Vector3(0f,-15.9f,0f), new Vector3(-9.1f,-25.1f,0f), new Vector3(0f,0f,0f) };
        GameObject cubeRound = Instantiate( boxNoCollider ) as GameObject;
        cubeRound.name = "bRound";
        Vector3 onStartPos = cubeRound.transform.position;
        LeanTween.moveLocal(cubeRound, roundCirc, 0.5f).setOnComplete( ()=>{
            LeanTest.expect(cubeRound.transform.position==onStartPos, "BEZIER CLOSED LOOP SHOULD END AT START","onStartPos:"+onStartPos+" onEnd:"+cubeRound.transform.position);
        });

        // Spline should end at exact end position not just 99% close to it
        Vector3[] roundSpline = new Vector3[]{ new Vector3(0f,0f,0f), new Vector3(0f,0f,0f), new Vector3(2f,0f,0f), new Vector3(0.9f,2f,0f), new Vector3(0f,0f,0f), new Vector3(0f,0f,0f) };
        GameObject cubeSpline = Instantiate( boxNoCollider ) as GameObject;
        cubeSpline.name = "bSpline";
        Vector3 onStartPosSpline = cubeSpline.transform.position;
        LeanTween.moveSplineLocal(cubeSpline, roundSpline, 0.5f).setOnComplete( ()=>{
            LeanTest.expect(Vector3.Distance(onStartPosSpline, cubeSpline.transform.position) <= 0.01f, "BEZIER CLOSED LOOP SHOULD END AT START","onStartPos:"+onStartPosSpline+" onEnd:"+cubeSpline.transform.position+" dist:"+Vector3.Distance(onStartPosSpline, cubeSpline.transform.position));
        });

        // Groups of tweens testing
        groupTweens = new LTDescr[ 1200 ];
        groupGOs = new GameObject[ groupTweens.Length ];
        groupTweensCnt = 0;
        int descriptionMatchCount = 0;
        for(int i = 0; i < groupTweens.Length; i++){
            GameObject cube = Instantiate( boxNoCollider ) as GameObject;
            cube.name = "c"+i;
            cube.transform.position = new Vector3(0,0,i*3);

            groupGOs[i] = cube;
        }

        yield return new WaitForEndOfFrame();

        bool hasGroupTweensCheckStarted = false;
        int setOnStartNum = 0;
        for(int i = 0; i < groupTweens.Length; i++){
            groupTweens[i] = LeanTween.move(groupGOs[i], transform.position + Vector3.one*3f, 3f ).setOnStart( ()=>{
                setOnStartNum++;
            }).setOnComplete( ()=>{
                if(hasGroupTweensCheckStarted==false){
                    hasGroupTweensCheckStarted = true;
                    LeanTween.delayedCall(gameObject, 0.1f, ()=>{
                        LeanTest.expect( setOnStartNum == groupTweens.Length, "SETONSTART CALLS", "expected:"+groupTweens.Length+" was:"+setOnStartNum);
                        LeanTest.expect( groupTweensCnt==groupTweens.Length, "GROUP FINISH", "expected "+groupTweens.Length+" tweens but got "+groupTweensCnt);
                    });
                }
                groupTweensCnt++;
            });

            if(LeanTween.description(groupTweens[i].id).trans==groupTweens[i].trans)
                descriptionMatchCount++;
        }

        while (LeanTween.tweensRunning<groupTweens.Length)
            yield return null;

        LeanTest.expect( descriptionMatchCount==groupTweens.Length, "GROUP IDS MATCH" );
        LeanTest.expect( LeanTween.maxSearch<=groupTweens.Length+5, "MAX SEARCH OPTIMIZED", "maxSearch:"+LeanTween.maxSearch );
        LeanTest.expect( LeanTween.isTweening() == true, "SOMETHING IS TWEENING" );

        // resume item before calling pause should continue item along it's way
        float previousXlt4 = cube4.transform.position.x;
        lt4 = LeanTween.moveX( cube4, 5.0f, 1.1f).setOnComplete( ()=>{
            LeanTest.expect( cube4!=null && previousXlt4!=cube4.transform.position.x, "RESUME OUT OF ORDER", "cube4:"+cube4+" previousXlt4:"+previousXlt4+" cube4.transform.position.x:"+(cube4!=null ? cube4.transform.position.x : 0));
        });
        lt4.resume();

        rotateRepeat = rotateRepeatAngle = 0;
        LeanTween.rotateAround(cube3, Vector3.forward, 360f, 0.1f).setRepeat(3).setOnComplete(rotateRepeatFinished).setOnCompleteOnRepeat(true).setDestroyOnComplete(true);
        yield return new WaitForEndOfFrame();
        LeanTween.delayedCall(0.1f*8f+1f, rotateRepeatAllFinished);

        int countBeforeCancel = LeanTween.tweensRunning;
        LeanTween.cancel( lt1Id );
        LeanTest.expect( countBeforeCancel==LeanTween.tweensRunning, "CANCEL AFTER RESET SHOULD FAIL", "expected "+countBeforeCancel+" but got "+LeanTween.tweensRunning);
        LeanTween.cancel(cube2);

        int tweenCount = 0;
        for(int i = 0; i < groupTweens.Length; i++){
            if(LeanTween.isTweening( groupGOs[i] ))
                tweenCount++;
            if(i%3==0)
                LeanTween.pause( groupGOs[i] );
            else if(i%3==1)
                groupTweens[i].pause();
//.........这里部分代码省略.........
开发者ID:602147629,项目名称:LeanTween,代码行数:101,代码来源:TestingEverything.cs

示例2: timeBasedTesting


//.........这里部分代码省略.........
                        setPosNum++;
                    else{
            //						Debug.Log("neededPos:"+neededPos+" tweenedGo.transform.position:"+tweenedGo.transform.position);
                    }
                    if(hasGroupTweensCheckStarted==false){
                        hasGroupTweensCheckStarted = true;
                        LeanTween.delayedCall(gameObject, 0.1f, ()=>{
                            LeanTest.expect( setOnStartNum == groupTweens.Length, "SETONSTART CALLS", "expected:"+groupTweens.Length+" was:"+setOnStartNum);
                            LeanTest.expect( groupTweensCnt==groupTweens.Length, "GROUP FINISH", "expected "+groupTweens.Length+" tweens but got "+groupTweensCnt);
                            LeanTest.expect( setPosNum==groupTweens.Length, "GROUP POSITION FINISH", "expected "+groupTweens.Length+" tweens but got "+setPosNum);
                            LeanTest.expect( setPosOnUpdate, "GROUP POSITION ON UPDATE");
                        });
                    }
                    groupTweensCnt++;
                });

                if(LeanTween.description(groupTweens[i].id).trans==groupTweens[i].trans)
                    descriptionMatchCount++;
            }

            while (LeanTween.tweensRunning<groupTweens.Length)
                yield return null;

            LeanTest.expect( descriptionMatchCount==groupTweens.Length, "GROUP IDS MATCH" );
            int expectedSearch = groupTweens.Length+5;
            LeanTest.expect( LeanTween.maxSearch<=expectedSearch, "MAX SEARCH OPTIMIZED", "maxSearch:"+LeanTween.maxSearch+" should be:"+ expectedSearch);
            LeanTest.expect( LeanTween.isTweening() == true, "SOMETHING IS TWEENING" );

            // resume item before calling pause should continue item along it's way
            float previousXlt4 = cube4.transform.position.x;
            lt4 = LeanTween.moveX( cube4, 5.0f, 1.1f).setOnComplete( ()=>{
                LeanTest.expect( cube4!=null && previousXlt4!=cube4.transform.position.x, "RESUME OUT OF ORDER", "cube4:"+cube4+" previousXlt4:"+previousXlt4+" cube4.transform.position.x:"+(cube4!=null ? cube4.transform.position.x : 0));
            }).setDestroyOnComplete( true );
            lt4.resume();

            rotateRepeat = rotateRepeatAngle = 0;
            LeanTween.rotateAround(cube3, Vector3.forward, 360f, 0.1f).setRepeat(3).setOnComplete(rotateRepeatFinished).setOnCompleteOnRepeat(true).setDestroyOnComplete(true);
            yield return new WaitForEndOfFrame();
            LeanTween.delayedCall(0.1f*8f+1f, rotateRepeatAllFinished);

            int countBeforeCancel = LeanTween.tweensRunning;
            LeanTween.cancel( lt1Id );
            LeanTest.expect( countBeforeCancel==LeanTween.tweensRunning, "CANCEL AFTER RESET SHOULD FAIL", "expected "+countBeforeCancel+" but got "+LeanTween.tweensRunning);
            LeanTween.cancel(cube2);

            int tweenCount = 0;
            for(int i = 0; i < groupTweens.Length; i++){
                if(LeanTween.isTweening( groupGOs[i] ))
                    tweenCount++;
                if(i%3==0)
                    LeanTween.pause( groupGOs[i] );
                else if(i%3==1)
                    groupTweens[i].pause();
                else
                    LeanTween.pause( groupTweens[i].id );
            }
            LeanTest.expect( tweenCount==groupTweens.Length, "GROUP ISTWEENING", "expected "+groupTweens.Length+" tweens but got "+tweenCount );

            yield return new WaitForEndOfFrame();

            tweenCount = 0;
            for(int i = 0; i < groupTweens.Length; i++){
                if(i%3==0)
                    LeanTween.resume( groupGOs[i] );
                else if(i%3==1)
                    groupTweens[i].resume();
开发者ID:dentedpixel,项目名称:LeanTween,代码行数:67,代码来源:TestingUnitTests.cs

示例3: timeBasedTesting

	IEnumerator timeBasedTesting(){
		yield return new WaitForEndOfFrame();
		yield return new WaitForEndOfFrame();

		// Groups of tweens testing
		groupTweens = new LTDescr[ 300 ];
		groupGOs = new GameObject[ groupTweens.Length ];
		groupTweensCnt = 0;
		int descriptionMatchCount = 0;
		for(int i = 0; i < groupTweens.Length; i++){
			GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
			Destroy( cube.GetComponent( typeof(BoxCollider) ) as Component );
			cube.transform.position = new Vector3(0,0,i*3);
			cube.name = "c"+i;
			groupGOs[i] = cube;
			groupTweens[i] = LeanTween.move(cube, transform.position + Vector3.one*3f, 0.6f ).setOnComplete(groupTweenFinished);

			if(LeanTween.description(groupTweens[i].id).trans==groupTweens[i].trans)
				descriptionMatchCount++;
		}
		LeanTween.delayedCall(0.82f, groupTweensFinished);

		LeanTest.debug("GROUP IDS MATCH", descriptionMatchCount==groupTweens.Length );
		LeanTest.debug("MAX SEARCH OPTIMIZED", LeanTween.maxSearch<=groupTweens.Length+5, "maxSearch:"+LeanTween.maxSearch );

		// resume item before calling pause should continue item along it's way
		float previousXLT3 = cube3.transform.position.x;
		lt3 = LeanTween.moveX( cube3, 5.0f, 1.1f);
		lt3.resume();

		yield return new WaitForEndOfFrame();
		yield return new WaitForEndOfFrame();

		lt1.cancel();
		LeanTween.cancel(cube2);

		int tweenCount = 0;
		for(int i = 0; i < groupTweens.Length; i++){
			if(LeanTween.isTweening( groupGOs[i] ))
				tweenCount++;
			if(i%3==0)
				LeanTween.pause( groupGOs[i] );
			else if(i%3==1)
				groupTweens[i].pause();
			else
				LeanTween.pause( groupTweens[i].id );
		}
		LeanTest.debug("GROUP ISTWEENING", tweenCount==groupTweens.Length, "expected "+groupTweens.Length+" tweens but got "+tweenCount );

		LeanTest.debug("RESUME OUT OF ORDER", previousXLT3!=cube3.transform.position.x, "previousXLT3:"+previousXLT3+" cube3.transform.position.x:"+cube3.transform.position.x);

		yield return new WaitForEndOfFrame();

		tweenCount = 0;
		for(int i = 0; i < groupTweens.Length; i++){
			if(i%3==0)
				LeanTween.resume( groupGOs[i] );
			else if(i%3==1)
				groupTweens[i].resume();
			else
				LeanTween.resume( groupTweens[i].id );

			if(i%2==0 ? LeanTween.isTweening( groupTweens[i].id ) : LeanTween.isTweening( groupGOs[i] ) )
				tweenCount++;
		}
		LeanTest.debug("GROUP RESUME", tweenCount==groupTweens.Length );

		LeanTest.debug("CANCEL TWEEN LTDESCR", LeanTween.isTweening(cube1)==false );
		LeanTest.debug("CANCEL TWEEN LEANTWEEN", LeanTween.isTweening(cube2)==false );
	}
开发者ID:markofevil3,项目名称:SlotMachine,代码行数:70,代码来源:TestingEverything.cs

示例4: timeBasedTesting

    IEnumerator timeBasedTesting()
    {
        yield return new WaitForEndOfFrame();
        yield return new WaitForEndOfFrame();

        // Groups of tweens testing
        groupTweens = new LTDescr[ 300 ];
        groupGOs = new GameObject[ groupTweens.Length ];
        groupTweensCnt = 0;
        int descriptionMatchCount = 0;
        for(int i = 0; i < groupTweens.Length; i++){
            GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
            Destroy( cube.GetComponent( typeof(BoxCollider) ) as Component );
            cube.transform.position = new Vector3(0,0,i*3);
            cube.name = "c"+i;
            groupGOs[i] = cube;
            groupTweens[i] = LeanTween.move(cube, transform.position + Vector3.one*3f, 0.6f ).setOnComplete(groupTweenFinished);

            if(LeanTween.description(groupTweens[i].id).trans==groupTweens[i].trans)
                descriptionMatchCount++;
        }
        LeanTween.delayedCall(0.82f, groupTweensFinished);

        LeanTest.debug("GROUP IDS MATCH", descriptionMatchCount==groupTweens.Length );
        LeanTest.debug("MAX SEARCH OPTIMIZED", LeanTween.maxSearch<=groupTweens.Length+5, "maxSearch:"+LeanTween.maxSearch );
        LeanTest.debug("SOMETHING IS TWEENING", LeanTween.isTweening() == true );

        // resume item before calling pause should continue item along it's way
        float previousXLT3 = cube3.transform.position.x;
        lt3 = LeanTween.moveX( cube3, 5.0f, 1.1f);
        lt3.resume();

        yield return new WaitForEndOfFrame();
        yield return new WaitForEndOfFrame();

        lt1.cancel();
        LeanTween.cancel(cube2);

        int tweenCount = 0;
        for(int i = 0; i < groupTweens.Length; i++){
            if(LeanTween.isTweening( groupGOs[i] ))
                tweenCount++;
            if(i%3==0)
                LeanTween.pause( groupGOs[i] );
            else if(i%3==1)
                groupTweens[i].pause();
            else
                LeanTween.pause( groupTweens[i].id );
        }
        LeanTest.debug("GROUP ISTWEENING", tweenCount==groupTweens.Length, "expected "+groupTweens.Length+" tweens but got "+tweenCount );

        LeanTest.debug("RESUME OUT OF ORDER", previousXLT3!=cube3.transform.position.x, "previousXLT3:"+previousXLT3+" cube3.transform.position.x:"+cube3.transform.position.x);

        yield return new WaitForEndOfFrame();

        tweenCount = 0;
        for(int i = 0; i < groupTweens.Length; i++){
            if(i%3==0)
                LeanTween.resume( groupGOs[i] );
            else if(i%3==1)
                groupTweens[i].resume();
            else
                LeanTween.resume( groupTweens[i].id );

            if(i%2==0 ? LeanTween.isTweening( groupTweens[i].id ) : LeanTween.isTweening( groupGOs[i] ) )
                tweenCount++;
        }
        LeanTest.debug("GROUP RESUME", tweenCount==groupTweens.Length );

        LeanTest.debug("CANCEL TWEEN LTDESCR", LeanTween.isTweening(cube1)==false );
        LeanTest.debug("CANCEL TWEEN LEANTWEEN", LeanTween.isTweening(cube2)==false );

        Time.timeScale = 0.25f;
        float start = Time.realtimeSinceStartup;
        LeanTween.moveX(cube1, -5f, 0.2f).setOnComplete( ()=>{
            float end = Time.realtimeSinceStartup;
            float diff = end - start;
            LeanTest.debug("SCALED TIMING diff:"+diff, Mathf.Abs(0.8f - diff) < 0.05f, "expected to complete in 0.8f but completed in "+diff );
            LeanTest.debug("SCALED ENDING POSITION", Mathf.Approximately(cube1.transform.position.x, -5f), "expected to end at -5f, but it ended at "+cube1.transform.position.x);
        });

        int ltCount = 0;
        GameObject[] allGos = FindObjectsOfType(typeof(GameObject)) as GameObject[];
        foreach (GameObject go in allGos) {
            if(go.name == "~LeanTween")
             	ltCount++;
        }
        LeanTest.debug("RESET CORRECTLY CLEANS UP", ltCount==1 );
    }
开发者ID:hadeszs,项目名称:Tower-Defence-Unity-master-original,代码行数:89,代码来源:TestingEverything.cs

示例5: timeBasedTesting

	IEnumerator timeBasedTesting(){
		yield return new WaitForEndOfFrame();
		yield return new WaitForEndOfFrame();

		Time.timeScale = 0.25f;
		float tweenTime = 0.2f;
		float start = Time.realtimeSinceStartup;
		bool onUpdateWasCalled = false;
		LeanTween.moveX(cube1, -5f, tweenTime).setOnUpdate( (float val)=>{
			onUpdateWasCalled = true;
		}).setOnComplete( ()=>{
			float end = Time.realtimeSinceStartup;
			float diff = end - start;
			LeanTest.expect( Mathf.Abs( tweenTime * (1f/Time.timeScale) - diff) < 0.05f, "SCALED TIMING DIFFERENCE", "expected to complete in roughly 0.8f but completed in "+diff );
			LeanTest.expect( Mathf.Approximately(cube1.transform.position.x, -5f), "SCALED ENDING POSITION", "expected to end at -5f, but it ended at "+cube1.transform.position.x);
			LeanTest.expect( onUpdateWasCalled, "ON UPDATE FIRED" );
		});

		yield return new WaitForSeconds(1.0f);

		Time.timeScale = 1f;

		// Groups of tweens testing
		groupTweens = new LTDescr[ 1200 ];
		groupGOs = new GameObject[ groupTweens.Length ];
		groupTweensCnt = 0;
		int descriptionMatchCount = 0;
		for(int i = 0; i < groupTweens.Length; i++){
			GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
			Destroy( cube.GetComponent( typeof(BoxCollider) ) as Component );
			cube.transform.position = new Vector3(0,0,i*3);
			cube.name = "c"+i;
			groupGOs[i] = cube;
			groupTweens[i] = LeanTween.move(cube, transform.position + Vector3.one*3f, 0.6f ).setOnComplete(groupTweenFinished);

			if(LeanTween.description(groupTweens[i].id).trans==groupTweens[i].trans)
				descriptionMatchCount++;
		}
		LeanTween.delayedCall(gameObject, 0.82f, groupTweensFinished);

		LeanTest.expect( descriptionMatchCount==groupTweens.Length, "GROUP IDS MATCH" );
		LeanTest.expect( LeanTween.maxSearch<=groupTweens.Length+5, "MAX SEARCH OPTIMIZED", "maxSearch:"+LeanTween.maxSearch );
		LeanTest.expect( LeanTween.isTweening() == true, "SOMETHING IS TWEENING" );

		// resume item before calling pause should continue item along it's way
		float previousXlt4 = cube4.transform.position.x;
		lt4 = LeanTween.moveX( cube4, 5.0f, 1.1f).setOnComplete( ()=>{
			LeanTest.expect( cube4!=null && previousXlt4!=cube4.transform.position.x, "RESUME OUT OF ORDER", "cube4:"+cube4+" previousXlt4:"+previousXlt4+" cube4.transform.position.x:"+(cube4!=null ? cube4.transform.position.x : 0));
		});
		lt4.resume();

		yield return new WaitForSeconds(0.1f);

		int countBeforeCancel = LeanTween.tweensRunning;
		lt1.cancel();
		LeanTest.expect( countBeforeCancel==LeanTween.tweensRunning, "CANCEL AFTER RESET SHOULD FAIL", "expected "+countBeforeCancel+" but got "+LeanTween.tweensRunning);
		LeanTween.cancel(cube2);

		int tweenCount = 0;
		for(int i = 0; i < groupTweens.Length; i++){
			if(LeanTween.isTweening( groupGOs[i] ))
				tweenCount++;
			if(i%3==0)
				LeanTween.pause( groupGOs[i] );
			else if(i%3==1)
				groupTweens[i].pause();
			else
				LeanTween.pause( groupTweens[i].id );
		}
		LeanTest.expect( tweenCount==groupTweens.Length, "GROUP ISTWEENING", "expected "+groupTweens.Length+" tweens but got "+tweenCount );

		yield return new WaitForEndOfFrame();

		tweenCount = 0;
		for(int i = 0; i < groupTweens.Length; i++){
			if(i%3==0)
				LeanTween.resume( groupGOs[i] );
			else if(i%3==1)
				groupTweens[i].resume();
			else
				LeanTween.resume( groupTweens[i].id );

			if(i%2==0 ? LeanTween.isTweening( groupTweens[i].id ) : LeanTween.isTweening( groupGOs[i] ) )
				tweenCount++;
		}
		LeanTest.expect( tweenCount==groupTweens.Length, "GROUP RESUME" );

		LeanTest.expect( LeanTween.isTweening(cube1)==false, "CANCEL TWEEN LTDESCR" );
		LeanTest.expect( LeanTween.isTweening(cube2)==false, "CANCEL TWEEN LEANTWEEN" );

		

		int ltCount = 0;
		GameObject[] allGos = FindObjectsOfType(typeof(GameObject)) as GameObject[];
        foreach (GameObject go in allGos) {
            if(go.name == "~LeanTween")
		     	ltCount++;
        }
		LeanTest.expect( ltCount==1, "RESET CORRECTLY CLEANS UP" );
	}
开发者ID:YanivP,项目名称:FriendBubbles,代码行数:100,代码来源:TestingEverything.cs


注:本文中的LTDescr.resume方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。