moveLocalZ() public static method

public static moveLocalZ ( GameObject gameObject, float to, float time ) : LTDescr,
gameObject GameObject
to float
time float
return LTDescr,
	// Use this for initialization
	void Start () {
		// Recursion - Set a objects value and have it recursively effect it's children
		LeanTween.alpha( avatarRecursive, 0f, 1f).setRecursive(true).setLoopPingPong();
		LeanTween.alpha( avatar2dRecursive, 0f, 1f).setRecursive(true).setLoopPingPong();
		LeanTween.alpha( wingPersonPanel, 0f, 1f).setRecursive(true).setLoopPingPong();

		// Destroy on Complete - 

		// Chaining tweens together

		// setOnCompleteOnRepeat


		// Move to path of transforms that are moving themselves
		LeanTween.value( avatarMove, 0f, (float)movePts.Length-1, 5f).setOnUpdate((float val)=>{
			int first = (int)Mathf.Floor(val);
			int next = first < movePts.Length-1 ? first + 1 : first;
			float diff = val - (float)first;
			// Debug.Log("val:"+val+" first:"+first+" next:"+next);
			Vector3 diffPos = (movePts[next].position-movePts[first].position);
			avatarMove.transform.position = movePts[first].position + diffPos*diff;
		}).setEase(LeanTweenType.easeInOutExpo).setLoopPingPong();

		// move the pts
		for(int i = 0; i < movePts.Length; i++)
			LeanTween.moveY( movePts[i].gameObject, movePts[i].position.y + 1.5f, 1f).setDelay(((float)i)*0.2f).setLoopPingPong();


		// move objects at a constant speed
		for(int i = 0; i < avatarSpeed.Length; i++)
			LeanTween.moveLocalZ( avatarSpeed[i], (i+1)*5f, 1f).setSpeed(6f).setEase(LeanTweenType.easeInOutExpo).setLoopPingPong(); // any time you set the speed it overrides the time value
	
		// move around a circle at a constant speed
		for(int i = 0; i < avatarSpeed2.Length; i++){
			LeanTween.moveLocal( avatarSpeed2[i], i == 0 ? circleSm : circleLrg, 1f).setSpeed(20f).setRepeat(-1);
		}
			
	}
Beispiel #2
0
    IEnumerator UnpauseCoroutine()
    {
        pauseButton.SetActive(true);
        resumeButton.SetActive(false);

        LeanTween.moveLocalY(pauseWindow, goWinPosOut, swipeTime).setEase(curve);

        LeanTween.moveLocalZ(ghostObject, originalGSpeed, ghostTimer).setEase(ghostCurve).setDelay(swipeTime / 2f); // THIS WILL SLOW DOWN GLOBAL SPEED.

        ballAnimator.SetBool("isRolling", true);
        ballAnimator.speed = 1f;

        yield return(new WaitForSeconds(swipeTime / 2f));

        BallSideController.playerIsInControl = true;

        //yield return new WaitForSeconds(ghostTimer + (swipeTime/2f));
        yield return(new WaitForSeconds(swipeTime / 2f));

        yield return(new WaitForSeconds(ghostTimer));

        isGameOver = false;
    }
Beispiel #3
0
    void AttackStart()
    {
        if (hitEye)
        {
            hitEye.gameObject.SetActive(true);

            LeanTween.alpha(hitEye, 0.5f, 0.15f).setEase(LeanTweenType.easeInQuad);
            LeanTween.alpha(hitEye, 0f, 0.2f).setEase(LeanTweenType.easeOutQuad).setDelay(0.15f).setOnComplete(HitEyeAlphaComplete);
            LeanTween.moveLocalZ(Player.leapOVR, Random.Range(1, 4) * 0.1f, 0.1f).setEase(LeanTweenType.easeInQuad);
            LeanTween.moveLocalZ(Player.leapOVR, 0f, 0.15f).setEase(LeanTweenType.easeInQuad).setDelay(0.1f);
        }



        faceRenderer.material.SetTexture("_MainTex", attackTex);
        //jump
        int rnd1 = Random.Range(0, 4);

        if (rnd1 == 0)
        {
            animator.SetTrigger("Jump");
        }

        if (gameObject.name == KingName)
        {
            float rnd = Random.Range(0, 2);
            Debug.Log(rnd);
            if (rnd == 0)
            {
                audio.PlayOneShot(attack1Sound);
            }
            else
            {
                audio.PlayOneShot(attack2Sound);
            }
        }
    }
Beispiel #4
0
    IEnumerator StartRollingCoroutine()
    {
        pBar.ProgressStart();

        hinterUp.enabled = false;

        ballAnimator.SetBool("isRolling", true);
        startedRolling = true;
        BallSideController.playerIsInControl = true;

        upArrowAnimator.SetBool("hasServed", true);

        LeanTween.moveLocalZ(ghostObject, -5f, ghostTimerStop).setEase(ghostCurve); // THIS WILL ACCELERATE GLOBAL SPEED.

        yield return(new WaitForSeconds(ghostTimerStop));

        forgetAboutThis = true;
        startedRolling  = false;

        yield return(new WaitForSeconds(ghostTimerStop));

        upArrowGo.SetActive(false);
        sideArrowGo.SetActive(true);
    }
Beispiel #5
0
    IEnumerator PlayCutscene()
    {
        //Entry sequence
        shakeEffect = true;
        entryPS.Play();
        mainSrc.PlayOneShot(wooshingWindSound);
        ambientSrc.Play();
        cameraManager.Set(entryCam);
        yield return(new WaitForSeconds(entrySequenceTime));

        mainSrc.Stop();
        mainSrc.PlayOneShot(godSound);
        cameraManager.Set(godCam);
        shakeEffect = false;
        entryPS.Stop();

        //God sequence
        fakePlayer.transform.position = godStartingPos.position;
        LeanTween.moveLocalZ(cloudParent.gameObject, 223f, 3f);
        LTSeq sequence = LeanTween.sequence();

        sequence.append(LeanTween.move(fakePlayer, godFinalPos, 1.5f).setEase(LeanTweenType.easeOutCirc));
        sequence.append(LeanTween.move(fakePlayer, godStartingPos, 1.5f).setEase(LeanTweenType.easeInCirc).setOnComplete(EndSequence));
    }
Beispiel #6
0
    IEnumerator BubbleSortAlgorithm(GameObject[] unsortedList)
    {
        GameObject temp;
        Vector3    tempPosition;

        for (int i = 0; i < unsortedList.Length - 1; i++)
        {
            yield return(new WaitForSeconds(0.5f * AlgorithmDetails.Speed));

            // Last i elements are already in the correct place.
            for (int j = 0; j < unsortedList.Length - i - 1; j++)
            {
                bool last = j == unsortedList.Length - i - 2;
                // Highlight current cubes being compared as blue.
                LeanTween.color(unsortedList[j], Color.blue, 0);
                LeanTween.color(unsortedList[j + 1], Color.blue, 0);
                yield return(new WaitForSeconds(0.5f * AlgorithmDetails.Speed));

                if (unsortedList[j].transform.localScale.y > unsortedList[j + 1].transform.localScale.y)
                {
                    //Colour change to red when swapping.
                    LeanTween.color(unsortedList[j], Color.red, 0);
                    LeanTween.color(unsortedList[j + 1], Color.red, 0);

                    // Swap array elements.
                    temp                = unsortedList[j];
                    unsortedList[j]     = unsortedList[j + 1];
                    unsortedList[j + 1] = temp;

                    tempPosition = unsortedList[j].transform.localPosition;

                    // Using LeanTween for animations, swaps the cubes
                    LeanTween.moveLocalX(unsortedList[j],
                                         unsortedList[j + 1].transform.localPosition.x,
                                         1);

                    LeanTween.moveLocalZ(unsortedList[j],
                                         -3,
                                         0.5f).setLoopPingPong(1);

                    LeanTween.moveLocalX(unsortedList[j + 1],
                                         tempPosition.x,
                                         1);

                    LeanTween.moveLocalZ(unsortedList[j + 1],
                                         3,
                                         0.5f).setLoopPingPong(1);
                    if (last)
                    {
                        // If last element being sorted, then change colour to green as it's in its correct position.
                        LeanTween.color(unsortedList[j + 1], Color.green, 1f);
                    }
                    else
                    {
                        LeanTween.color(unsortedList[j + 1], Color.white, 1f);
                    }
                    LeanTween.color(unsortedList[j], Color.white, 1f);
                    yield return(new WaitForSeconds(1f));

                    continue;
                }
                LeanTween.color(unsortedList[j], Color.white, 0);
                // Deals with case of when the last element is being compared.
                if (last && i == unsortedList.Length - 2)
                {
                    LeanTween.color(unsortedList[j], Color.green, 1f);
                    LeanTween.color(unsortedList[j + 1], Color.green, 1f);
                }

                // If the last element is being sorted then change its colour to green as it's in its correct position.
                else if (last)
                {
                    LeanTween.color(unsortedList[j + 1], Color.green, 1f);
                }
                else
                {
                    LeanTween.color(unsortedList[j + 1], Color.white, 0);
                }
            }
        }
    }
Beispiel #7
0
 private void OnGazeOut()
 {
     LeanTween.cancel(this.transform.parent.gameObject);
     LeanTween.moveLocalZ(this.transform.parent.gameObject, 0f, 0.2f);
 }
 protected override void HandleEnter()
 {
     LeanTween.moveLocalZ(gameObject, -zMove, moveTime);
 }
 protected override void HandleExit()
 {
     LeanTween.moveLocalZ(gameObject, 0f, moveTime);
 }
Beispiel #10
0
        void Start()
        {
//			Time.timeScale = 0.25f;

            LeanTest.timeout  = 46f;
            LeanTest.expected = 56;

            LeanTween.init(15 + 1200);

            // add a listener
            LeanTween.addListener(cube1, 0, eventGameObjectCalled);

            LeanTest.expect(LeanTween.isTweening() == false, "NOTHING TWEEENING AT BEGINNING");

            LeanTest.expect(LeanTween.isTweening(cube1) == false, "OBJECT NOT TWEEENING AT BEGINNING");

            LeanTween.scaleX(cube4, 2f, 0f).setOnComplete(() => {
                LeanTest.expect(cube4.transform.localScale.x == 2f, "TWEENED WITH ZERO TIME");
            });

            // dispatch event that is received
            LeanTween.dispatchEvent(0);
            LeanTest.expect(eventGameObjectWasCalled, "EVENT GAMEOBJECT RECEIVED");

            // do not remove listener
            LeanTest.expect(LeanTween.removeListener(cube2, 0, eventGameObjectCalled) == false, "EVENT GAMEOBJECT NOT REMOVED");
            // remove listener
            LeanTest.expect(LeanTween.removeListener(cube1, 0, eventGameObjectCalled), "EVENT GAMEOBJECT REMOVED");

            // add a listener
            LeanTween.addListener(1, eventGeneralCalled);

            // dispatch event that is received
            LeanTween.dispatchEvent(1);
            LeanTest.expect(eventGeneralWasCalled, "EVENT ALL RECEIVED");

            // remove listener
            LeanTest.expect(LeanTween.removeListener(1, eventGeneralCalled), "EVENT ALL REMOVED");

            lt1Id = LeanTween.move(cube1, new Vector3(3f, 2f, 0.5f), 1.1f).id;
            LeanTween.move(cube2, new Vector3(-3f, -2f, -0.5f), 1.1f);

            LeanTween.reset();

            // Queue up a bunch of tweens, cancel some of them but expect the remainder to finish
            GameObject[] cubes    = new GameObject[99];
            int[]        tweenIds = new int[cubes.Length];
            for (int i = 0; i < cubes.Length; i++)
            {
                GameObject c = cubeNamed("cancel" + i);
                tweenIds[i] = LeanTween.moveX(c, 100f, 1f).id;
                cubes [i]   = c;
            }
            int onCompleteCount = 0;

            LeanTween.delayedCall(cubes[0], 0.2f, () => {
                for (int i = 0; i < cubes.Length; i++)
                {
                    if (i % 3 == 0)
                    {
                        LeanTween.cancel(cubes [i]);
                    }
                    else if (i % 3 == 1)
                    {
                        LeanTween.cancel(tweenIds[i]);
                    }
                    else if (i % 3 == 2)
                    {
                        LTDescr descr = LeanTween.descr(tweenIds[i]);
//						Debug.Log("descr:"+descr);
                        descr.setOnComplete(() => {
                            onCompleteCount++;
//							Debug.Log("onCompleteCount:"+onCompleteCount);
                            if (onCompleteCount >= 33)
                            {
                                LeanTest.expect(true, "CANCELS DO NOT EFFECT FINISHING");
                            }
                        });
                    }
                }
            });

            Vector3[] splineArr = new Vector3[] { new Vector3(-1f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(4f, 0f, 0f), new Vector3(20f, 0f, 0f), new Vector3(30f, 0f, 0f) };
            LTSpline  cr        = new LTSpline(splineArr);

            cr.place(cube4.transform, 0.5f);
            LeanTest.expect((Vector3.Distance(cube4.transform.position, new Vector3(10f, 0f, 0f)) <= 0.7f), "SPLINE POSITIONING AT HALFWAY", "position is:" + cube4.transform.position + " but should be:(10f,0f,0f)");
            LeanTween.color(cube4, Color.green, 0.01f);

//			Debug.Log("Point 2:"+cr.ratioAtPoint(splineArr[2]));

            // OnStart Speed Test for ignoreTimeScale vs normal timeScale

            GameObject cubeDest    = cubeNamed("cubeDest");
            Vector3    cubeDestEnd = new Vector3(100f, 20f, 0f);

            LeanTween.move(cubeDest, cubeDestEnd, 0.7f);

            GameObject cubeToTrans = cubeNamed("cubeToTrans");

            LeanTween.move(cubeToTrans, cubeDest.transform, 1.2f).setEase(LeanTweenType.easeOutQuad).setOnComplete(() => {
                LeanTest.expect(cubeToTrans.transform.position == cubeDestEnd, "MOVE TO TRANSFORM WORKS");
            });

            GameObject cubeDestroy = cubeNamed("cubeDestroy");

            LeanTween.moveX(cubeDestroy, 200f, 0.05f).setDelay(0.02f).setDestroyOnComplete(true);
            LeanTween.moveX(cubeDestroy, 200f, 0.1f).setDestroyOnComplete(true).setOnComplete(() => {
                LeanTest.expect(true, "TWO DESTROY ON COMPLETE'S SUCCEED");
            });

            GameObject cubeSpline = cubeNamed("cubeSpline");

            LeanTween.moveSpline(cubeSpline, new Vector3[] { new Vector3(0.5f, 0f, 0.5f), new Vector3(0.75f, 0f, 0.75f), new Vector3(1f, 0f, 1f), new Vector3(1f, 0f, 1f) }, 0.1f).setOnComplete(() => {
                LeanTest.expect(Vector3.Distance(new Vector3(1f, 0f, 1f), cubeSpline.transform.position) < 0.01f, "SPLINE WITH TWO POINTS SUCCEEDS");
            });

            // This test works when it is positioned last in the test queue (probably worth fixing when you have time)
            GameObject jumpCube = cubeNamed("jumpTime");

            jumpCube.transform.position    = new Vector3(100f, 0f, 0f);
            jumpCube.transform.localScale *= 100f;
            int jumpTimeId = LeanTween.moveX(jumpCube, 200f, 1f).id;

            LeanTween.delayedCall(gameObject, 0.2f, () => {
                LTDescr d     = LeanTween.descr(jumpTimeId);
                float beforeX = jumpCube.transform.position.x;
                d.setTime(0.5f);
                LeanTween.delayedCall(0.0f, () => { }).setOnStart(() => {
                    float diffAmt = 1f;                    // This variable is dependent on a good frame-rate because it evalutes at the next Update
                    beforeX      += Time.deltaTime * 100f * 2f;
                    LeanTest.expect(Mathf.Abs(jumpCube.transform.position.x - beforeX) < diffAmt, "CHANGING TIME DOESN'T JUMP AHEAD", "Difference:" + Mathf.Abs(jumpCube.transform.position.x - beforeX) + " beforeX:" + beforeX + " now:" + jumpCube.transform.position.x + " dt:" + Time.deltaTime);
                });
            });

            // Tween with time of zero is needs to be set to it's final value
            GameObject zeroCube = cubeNamed("zeroCube");

            LeanTween.moveX(zeroCube, 10f, 0f).setOnComplete(() => {
                LeanTest.expect(zeroCube.transform.position.x == 10f, "ZERO TIME FINSHES CORRECTLY", "final x:" + zeroCube.transform.position.x);
            });

            // Scale, and OnStart
            GameObject cubeScale = cubeNamed("cubeScale");

            LeanTween.scale(cubeScale, new Vector3(5f, 5f, 5f), 0.01f).setOnStart(() => {
                LeanTest.expect(true, "ON START WAS CALLED");
            }).setOnComplete(() => {
                LeanTest.expect(cubeScale.transform.localScale.z == 5f, "SCALE", "expected scale z:" + 5f + " returned:" + cubeScale.transform.localScale.z);
            });

            // Rotate
            GameObject cubeRotate = cubeNamed("cubeRotate");

            LeanTween.rotate(cubeRotate, new Vector3(0f, 180f, 0f), 0.02f).setOnComplete(() => {
                LeanTest.expect(cubeRotate.transform.eulerAngles.y == 180f, "ROTATE", "expected rotate y:" + 180f + " returned:" + cubeRotate.transform.eulerAngles.y);
            });

            // RotateAround
            GameObject cubeRotateA = cubeNamed("cubeRotateA");

            LeanTween.rotateAround(cubeRotateA, Vector3.forward, 90f, 0.3f).setOnComplete(() => {
                LeanTest.expect(cubeRotateA.transform.eulerAngles.z == 90f, "ROTATE AROUND", "expected rotate z:" + 90f + " returned:" + cubeRotateA.transform.eulerAngles.z);
            });

            // RotateAround 360
            GameObject cubeRotateB = cubeNamed("cubeRotateB");

            cubeRotateB.transform.position = new Vector3(200f, 10f, 8f);
            LeanTween.rotateAround(cubeRotateB, Vector3.forward, 360f, 0.3f).setPoint(new Vector3(5f, 3f, 2f)).setOnComplete(() => {
                LeanTest.expect(cubeRotateB.transform.position.ToString() == (new Vector3(200f, 10f, 8f)).ToString(), "ROTATE AROUND 360", "expected rotate pos:" + (new Vector3(200f, 10f, 8f)) + " returned:" + cubeRotateB.transform.position);
            });

            // Alpha, onUpdate with passing value, onComplete value
            LeanTween.alpha(cubeAlpha1, 0.5f, 0.1f).setOnUpdate((float val) => {
                LeanTest.expect(val != 0f, "ON UPDATE VAL");
            }).setOnCompleteParam("Hi!").setOnComplete((object completeObj) => {
                LeanTest.expect(((string)completeObj) == "Hi!", "ONCOMPLETE OBJECT");
                LeanTest.expect(cubeAlpha1.GetComponent <Renderer>().material.color.a == 0.5f, "ALPHA");
            });
            // Color
            float onStartTime = -1f;

            LeanTween.color(cubeAlpha2, Color.cyan, 0.3f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha2.GetComponent <Renderer>().material.color == Color.cyan, "COLOR");
                LeanTest.expect(onStartTime >= 0f && onStartTime < Time.time, "ON START", "onStartTime:" + onStartTime + " time:" + Time.time);
            }).setOnStart(() => {
                onStartTime = Time.time;
            });
            // moveLocalY (make sure uses y values)
            Vector3 beforePos = cubeAlpha1.transform.position;

            LeanTween.moveY(cubeAlpha1, 3f, 0.2f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha1.transform.position.x == beforePos.x && cubeAlpha1.transform.position.z == beforePos.z, "MOVE Y");
            });

            Vector3 beforePos2 = cubeAlpha2.transform.localPosition;

            LeanTween.moveLocalZ(cubeAlpha2, 12f, 0.2f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha2.transform.localPosition.x == beforePos2.x && cubeAlpha2.transform.localPosition.y == beforePos2.y, "MOVE LOCAL Z", "ax:" + cubeAlpha2.transform.localPosition.x + " bx:" + beforePos.x + " ay:" + cubeAlpha2.transform.localPosition.y + " by:" + beforePos2.y);
            });

            AudioClip audioClip = LeanAudio.createAudio(new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(1f, 0f, -1f, 0f)), new AnimationCurve(new Keyframe(0f, 0.001f, 0f, 0f), new Keyframe(1f, 0.001f, 0f, 0f)), LeanAudio.options());

            LeanTween.delayedSound(gameObject, audioClip, new Vector3(0f, 0f, 0f), 0.1f).setDelay(0.2f).setOnComplete(() => {
                LeanTest.expect(Time.time > 0, "DELAYED SOUND");
            });

            // Easing Methods
            int totalEasingCheck        = 0;
            int totalEasingCheckSuccess = 0;

            for (int j = 0; j < 2; j++)
            {
                bool isCheckingFrom       = j == 1;
                int  totalTweenTypeLength = (int)LeanTweenType.easeShake;
                for (int i = (int)LeanTweenType.notUsed; i < totalTweenTypeLength; i++)
                {
                    LeanTweenType easeType = (LeanTweenType)i;
                    GameObject    cube     = cubeNamed("cube" + easeType);
                    LTDescr       descr    = LeanTween.moveLocalX(cube, 5, 0.1f).setOnComplete((object obj) => {
                        GameObject cubeIn = obj as GameObject;
                        totalEasingCheck++;
                        if (cubeIn.transform.position.x == 5f)
                        {
                            totalEasingCheckSuccess++;
                        }
                        if (totalEasingCheck == (2 * totalTweenTypeLength))
                        {
                            LeanTest.expect(totalEasingCheck == totalEasingCheckSuccess, "EASING TYPES");
                        }
                    }).setOnCompleteParam(cube);

                    if (isCheckingFrom)
                    {
                        descr.setFrom(-5f);
                    }
                }
            }

            // value2
            bool value2UpdateCalled = false;

            LeanTween.value(gameObject, new Vector2(0, 0), new Vector2(256, 96), 0.1f).setOnUpdate((Vector2 value) => {
                value2UpdateCalled = true;
            });
            LeanTween.delayedCall(0.2f, () => {
                LeanTest.expect(value2UpdateCalled, "VALUE2 UPDATE");
            });

            // check descr
//			LTDescr descr2 = LeanTween.descr( descrId );
//			LeanTest.expect(descr2 == null,"DESCRIPTION STARTS AS NULL");

            StartCoroutine(timeBasedTesting());
        }
    // Update is called once per frame
    void Update()
    {
        MyOnMouseDown();
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (movedPawnNumberTest.Count > 0)
            {
                if (movedPawnNumberTest[movedPawnNumberTest.Count - 1] == pawnNumber)
                {
                    if (Selected() == 1)
                    {
                        movedPawnNumberReal.Add(movedPawnNumberTest[0]);
                        ClearList(movedPawnNumberTest);
                        for (int j = 0; j < 60 + 4 * 7; j++)
                        {
                            if (manager.board_[j] != null)
                            {
                                if (manager.board_[j].GetComponent <Square>().selectionStatus != ' ')
                                {
                                    if (manager.board_[j].GetComponent <Square>().selectionStatus == 'g')
                                    {
                                        if (moveBy == 7)
                                        {
                                            for (int i = 1; i <= 7; i++)
                                            {
                                                if (findId(i) == j)
                                                {
                                                    sevenMove -= i;
                                                }
                                            }
                                        }
                                        moveTo = manager.board_[j];
                                    }
                                    manager.board_[j].GetComponent <Square>().selectionStatus = ' ';
                                }
                            }
                        }
                        manager.LightBoard();
                        if (start)
                        {
                            start = false;
                        }
                        if (movedPawnNumberReal.Count > ((moveBy == 7) ? 1 : 0) || sevenMove == 0)
                        {
                            timer         = 1.0f;
                            selectionMade = true;
                        }
                    }
                }
            }
        }
        if (manager.turn == GetColor(color))
        {
            if (moveBy == 0)
            {
                if (die.rollStage == 2)
                {
                    moveBy = die.die1 + die.die2;
                    switch (moveBy)
                    {
                    case 1:
                        manager.text1.text = "Move One";
                        manager.text2.text = "Move any pawn in play into Home";
                        break;

                    case 10:
                        manager.text1.text = "Move Ten";
                        manager.text2.text = "Roll One Die";
                        break;

                    case 11:
                        manager.text1.text = "Move Eleven";
                        manager.text2.text = "Change between two pawns";
                        break;

                    case 12:
                        manager.text1.text = "Move One";
                        manager.text2.text = "Take a pawn out of start in substitute for someone else's";
                        break;
                    }
                }
                else if (die.rollStage == 0 && Input.GetKeyDown(KeyCode.Space))
                {
                    die.roll(true);
                }
                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    moveBy             = 1;
                    manager.text1.text = "Move One";
                    manager.text2.text = "Move any pawn in play into Home";
                }
            }
        }
        if (moveTo != null && selectionMade)
        {
            //  Debug.Log(pawnNumber + " " + moveTo.GetComponent<Square>().squareID);
            if (timer > 0.9f)
            {
                manager.text1.text = "";
                manager.text2.text = "";
                manager.choice1.GetComponent <MouseText>().setBig(false);
                manager.choice2.GetComponent <MouseText>().setBig(false);
                LeanTween.moveLocalY(gameObject, moveTo.transform.position.y + 1.25f, 0.3f);
            }
            else if (timer > 0.6f)
            {
                LeanTween.moveLocalZ(gameObject, moveTo.transform.position.z + ((float)rand.NextDouble() - 0.5f) / 4, 0.3f);
                LeanTween.moveLocalX(gameObject, moveTo.transform.position.x + ((float)rand.NextDouble() - 0.5f) / 4, 0.3f);
            }
            else if (timer > 0.0f)
            {
                LeanTween.moveLocalY(gameObject, moveTo.transform.position.y + 0.25f, 0.3f);
            }
            else
            {
                goThroughAll = false;
                sevenMove    = 7;
                timer        = 0.0f;
                choice       = 0;
                if (CheckWin() > -1)
                {
                    switch (CheckWin())
                    {
                    case 0:
                        manager.text1.text = "Yellow";
                        break;

                    case 1:
                        manager.text1.text = "Green";
                        break;

                    case 2:
                        manager.text1.text = "Red";
                        break;

                    case 3:
                        manager.text1.text = "Blue";
                        break;
                    }
                    manager.text2.text = "Wins!";
                }
                else
                {
                    if (!TakenOut())
                    {
                        selectionMade = false;
                        manager.turn  = ++manager.turn % manager.players;
                        foreach (GameObject pawn in manager.pawns)
                        {
                            if (pawn.GetComponent <PawnMove>().moveTo != null)
                            {
                                pawn.GetComponent <PawnMove>().currentID = pawn.GetComponent <PawnMove>().moveTo.GetComponent <Square>().squareID;
                                pawn.GetComponent <PawnMove>().moveTo    = null;
                            }
                            pawn.GetComponent <PawnMove>().moveBy = 0;
                            pawn.GetComponent <PawnMove>().ClearList(movedPawnNumberReal);
                        }
                    }
                    manager.LightBoard();
                }
            }
            timer -= Time.deltaTime;
        }
    }
Beispiel #12
0
 public override void PayloadArmed()
 {
     LeanTween.moveLocalZ(m_moveObject, 0.0f, 2.0f);
 }
Beispiel #13
0
 public static LTDescr LeanMoveLocalZ(this GameObject gameObject, float to, float time)
 {
     return(LeanTween.moveLocalZ(gameObject, to, time));
 }
Beispiel #14
0
 public void OpenWallsAndUI()
 {
     LeanTween.moveLocalZ(Lines.gameObject, 0, 1f);
     LeanTween.moveLocalY(ScoreTextField.gameObject, 440f, 0.7f).setEaseInOutCubic().setDelay(0.4f);
     LeanTween.moveLocalY(MenuButton.gameObject, 450f, 0.7f).setEaseInOutCubic().setDelay(0.4f);
 }
Beispiel #15
0
 public static LTDescr moveLocalByZ(GameObject go, float offsetZ, float time)
 {
     return(LeanTween.moveLocalZ(go, go.transform.position.z + offsetZ, time));
 }
Beispiel #16
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         if (movedPawnNumber == pawnNumber)
         {
             //  if((moveBy + currentID) % 60 < moveBy % 60)
             //      Debug.Log(moveBy + currentID);
             moveTo      = selectBoard;
             selectBoard = null;
             timer       = 1.5f;
             if (start)
             {
                 start = false;
             }
             selectionMade = true;
         }
         else
         {
             moveBy = 0;
         }
     }
     if (moveBy == 0)
     {
         if (Input.GetKeyDown(KeyCode.Alpha1))
         {
             moveBy = 1;
         }
         if (Input.GetKeyDown(KeyCode.Alpha2))
         {
             moveBy = 2;
         }
         if (Input.GetKeyDown(KeyCode.Alpha3))
         {
             moveBy = 3;
         }
         if (Input.GetKeyDown(KeyCode.Alpha4))
         {
             moveBy = 4;
         }
         if (Input.GetKeyDown(KeyCode.Alpha5))
         {
             moveBy = 5;
         }
         if (Input.GetKeyDown(KeyCode.Alpha9))
         {
             moveBy = 9;
         }
     }
     if (moveTo != null && movedPawnNumber > -1 && selectionMade)
     {
         moveTo.GetComponent <SpriteRenderer>().color = unSelected;
         if (timer > 1.2f)
         {
             LeanTween.moveLocalY(gameObject, moveTo.transform.position.y + 1.25f, 0.3f);
         }
         else if (timer > 0.9f)
         {
             float tempId = moveTo.GetComponent <Square>().squareID;
             LeanTween.moveLocalZ(gameObject, moveTo.transform.position.z + (Random.value - 0.5f) / ((tempId % 15 != 5 || tempId < 65) ? 4 : 1), 0.3f);
             LeanTween.moveLocalX(gameObject, moveTo.transform.position.x + (Random.value - 0.5f) / ((tempId % 15 != 5 || tempId < 65) ? 4 : 1), 0.3f);
         }
         else if (timer > 0.6f)
         {
             LeanTween.moveLocalY(gameObject, moveTo.transform.position.y + 0.25f, 0.3f);
         }
         else
         {
             timer           = 0.0f;
             currentID       = moveTo.GetComponent <Square>().squareID;
             moveBy          = 0;
             moveTo          = null;
             movedPawnNumber = -1;
             selectionMade   = false;
             manager.GetComponent <GameManager>().turn = ++manager.GetComponent <GameManager>().turn % 4;
         }
         timer -= Time.deltaTime;
     }
 }
Beispiel #17
0
 public override void PayloadArmed()
 {
     LeanTween.moveLocalZ(m_movingObject, 1.5f, 0.5f);
 }
Beispiel #18
0
 void OnTriggerEnter(Collider other)
 {
     LeanTween.moveLocalZ(door1, 1.5f, 0.2f);
     LeanTween.moveLocalZ(door2, -1.5f, 0.2f);
 }
Beispiel #19
0
 public static void MoveLocalZ(GameObject obj, float endPos, float duration, LeanTweenType easetype = LeanTweenType.linear)
 {
     LeanTween.moveLocalZ(obj, endPos, duration).setEase(easetype);
 }
Beispiel #20
0
 private void OnGaseDown()
 {
     LeanTween.cancel(this.transform.parent.gameObject);
     LeanTween.moveLocalZ(this.transform.parent.gameObject, 10f, 0.1f);
 }
Beispiel #21
0
        void Start()
        {
//			Time.timeScale = 0.25f;

            LeanTest.timeout  = 46f;
            LeanTest.expected = 50;

            LeanTween.init(15 + 1200);
            // add a listener
            LeanTween.addListener(cube1, 0, eventGameObjectCalled);

            LeanTest.expect(LeanTween.isTweening() == false, "NOTHING TWEEENING AT BEGINNING");

            LeanTest.expect(LeanTween.isTweening(cube1) == false, "OBJECT NOT TWEEENING AT BEGINNING");

            LeanTween.scaleX(cube4, 2f, 0f).setOnComplete(() => {
                LeanTest.expect(cube4.transform.localScale.x == 2f, "TWEENED WITH ZERO TIME");
            });

            // dispatch event that is received
            LeanTween.dispatchEvent(0);
            LeanTest.expect(eventGameObjectWasCalled, "EVENT GAMEOBJECT RECEIVED");

            // do not remove listener
            LeanTest.expect(LeanTween.removeListener(cube2, 0, eventGameObjectCalled) == false, "EVENT GAMEOBJECT NOT REMOVED");
            // remove listener
            LeanTest.expect(LeanTween.removeListener(cube1, 0, eventGameObjectCalled), "EVENT GAMEOBJECT REMOVED");

            // add a listener
            LeanTween.addListener(1, eventGeneralCalled);

            // dispatch event that is received
            LeanTween.dispatchEvent(1);
            LeanTest.expect(eventGeneralWasCalled, "EVENT ALL RECEIVED");

            // remove listener
            LeanTest.expect(LeanTween.removeListener(1, eventGeneralCalled), "EVENT ALL REMOVED");

            lt1Id = LeanTween.move(cube1, new Vector3(3f, 2f, 0.5f), 1.1f).id;
            LeanTween.move(cube2, new Vector3(-3f, -2f, -0.5f), 1.1f);

            LeanTween.reset();

            Vector3[] splineArr = new Vector3[] { new Vector3(-1f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(4f, 0f, 0f), new Vector3(20f, 0f, 0f), new Vector3(30f, 0f, 0f) };
            LTSpline  cr        = new LTSpline(splineArr);

            cr.place(cube4.transform, 0.5f);
            LeanTest.expect((Vector3.Distance(cube4.transform.position, new Vector3(10f, 0f, 0f)) <= 0.7f), "SPLINE POSITIONING AT HALFWAY", "position is:" + cube4.transform.position + " but should be:(10f,0f,0f)");
            LeanTween.color(cube4, Color.green, 0.01f);

//			Debug.Log("Point 2:"+cr.ratioAtPoint(splineArr[2]));

            // OnStart Speed Test for ignoreTimeScale vs normal timeScale

            GameObject cubeDest    = cubeNamed("cubeDest");
            Vector3    cubeDestEnd = new Vector3(100f, 20f, 0f);

            LeanTween.move(cubeDest, cubeDestEnd, 0.7f);

            GameObject cubeToTrans = cubeNamed("cubeToTrans");

            LeanTween.move(cubeToTrans, cubeDest.transform, 1.2f).setEase(LeanTweenType.easeOutQuad).setOnComplete(() => {
                LeanTest.expect(cubeToTrans.transform.position == cubeDestEnd, "MOVE TO TRANSFORM WORKS");
            });

            GameObject cubeDestroy = cubeNamed("cubeDestroy");

            LeanTween.moveX(cubeDestroy, 200f, 0.05f).setDelay(0.02f).setDestroyOnComplete(true);
            LeanTween.moveX(cubeDestroy, 200f, 0.1f).setDestroyOnComplete(true).setOnComplete(() => {
                LeanTest.expect(true, "TWO DESTROY ON COMPLETE'S SUCCEED");
            });

            GameObject cubeSpline = cubeNamed("cubeSpline");

            LeanTween.moveSpline(cubeSpline, new Vector3[] { new Vector3(0.5f, 0f, 0.5f), new Vector3(0.75f, 0f, 0.75f), new Vector3(1f, 0f, 1f), new Vector3(1f, 0f, 1f) }, 0.1f).setOnComplete(() => {
                LeanTest.expect(Vector3.Distance(new Vector3(1f, 0f, 1f), cubeSpline.transform.position) < 0.01f, "SPLINE WITH TWO POINTS SUCCEEDS");
            });

            // This test works when it is positioned last in the test queue (probably worth fixing when you have time)
            GameObject jumpCube = cubeNamed("jumpTime");

            jumpCube.transform.position    = new Vector3(100f, 0f, 0f);
            jumpCube.transform.localScale *= 100f;
            int jumpTimeId = LeanTween.moveX(jumpCube, 200f, 1f).id;

            LeanTween.delayedCall(gameObject, 0.2f, () => {
                LTDescr d     = LeanTween.descr(jumpTimeId);
                float beforeX = jumpCube.transform.position.x;
                d.setTime(0.5f);
                LeanTween.delayedCall(0.0f, () => { }).setOnStart(() => {
                    float diffAmt = 1f;                    // This variable is dependent on a good frame-rate because it evalutes at the next Update
                    beforeX      += Time.deltaTime * 100f * 2f;
                    LeanTest.expect(Mathf.Abs(jumpCube.transform.position.x - beforeX) < diffAmt, "CHANGING TIME DOESN'T JUMP AHEAD", "Difference:" + Mathf.Abs(jumpCube.transform.position.x - beforeX) + " beforeX:" + beforeX + " now:" + jumpCube.transform.position.x + " dt:" + Time.deltaTime);
                });
            });

            // Tween with time of zero is needs to be set to it's final value
            GameObject zeroCube = cubeNamed("zeroCube");

            LeanTween.moveX(zeroCube, 10f, 0f).setOnComplete(() => {
                LeanTest.expect(zeroCube.transform.position.x == 10f, "ZERO TIME FINSHES CORRECTLY", "final x:" + zeroCube.transform.position.x);
            });

            // Scale, and OnStart
            GameObject cubeScale = cubeNamed("cubeScale");

            LeanTween.scale(cubeScale, new Vector3(5f, 5f, 5f), 0.01f).setOnStart(() => {
                LeanTest.expect(true, "ON START WAS CALLED");
            }).setOnComplete(() => {
                LeanTest.expect(cubeScale.transform.localScale.z == 5f, "SCALE", "expected scale z:" + 5f + " returned:" + cubeScale.transform.localScale.z);
            });

            // Rotate
            GameObject cubeRotate = cubeNamed("cubeRotate");

            LeanTween.rotate(cubeRotate, new Vector3(0f, 180f, 0f), 0.02f).setOnComplete(() => {
                LeanTest.expect(cubeRotate.transform.eulerAngles.y == 180f, "ROTATE", "expected rotate y:" + 180f + " returned:" + cubeRotate.transform.eulerAngles.y);
            });

            // RotateAround
            GameObject cubeRotateA = cubeNamed("cubeRotateA");

            LeanTween.rotateAround(cubeRotateA, Vector3.forward, 90f, 0.3f).setOnComplete(() => {
                LeanTest.expect(cubeRotateA.transform.eulerAngles.z == 90f, "ROTATE AROUND", "expected rotate z:" + 90f + " returned:" + cubeRotateA.transform.eulerAngles.z);
            });
            // Alpha, onUpdate with passing value, onComplete value
            LeanTween.alpha(cubeAlpha1, 0.5f, 0.1f).setOnUpdate((float val) => {
                LeanTest.expect(val != 0f, "ON UPDATE VAL");
            }).setOnCompleteParam("Hi!").setOnComplete((object completeObj) => {
                LeanTest.expect(((string)completeObj) == "Hi!", "ONCOMPLETE OBJECT");
                LeanTest.expect(cubeAlpha1.GetComponent <Renderer>().material.color.a == 0.5f, "ALPHA");
            });
            // Color
            float onStartTime = -1f;

            LeanTween.color(cubeAlpha2, Color.cyan, 0.3f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha2.GetComponent <Renderer>().material.color == Color.cyan, "COLOR");
                LeanTest.expect(onStartTime >= 0f && onStartTime < Time.time, "ON START", "onStartTime:" + onStartTime + " time:" + Time.time);
            }).setOnStart(() => {
                onStartTime = Time.time;
            });
            // moveLocalY (make sure uses y values)
            Vector3 beforePos = cubeAlpha1.transform.position;

            LeanTween.moveY(cubeAlpha1, 3f, 0.2f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha1.transform.position.x == beforePos.x && cubeAlpha1.transform.position.z == beforePos.z, "MOVE Y");
            });

            Vector3 beforePos2 = cubeAlpha2.transform.localPosition;

            LeanTween.moveLocalZ(cubeAlpha2, 12f, 0.2f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha2.transform.localPosition.x == beforePos2.x && cubeAlpha2.transform.localPosition.y == beforePos2.y, "MOVE LOCAL Z", "ax:" + cubeAlpha2.transform.localPosition.x + " bx:" + beforePos.x + " ay:" + cubeAlpha2.transform.localPosition.y + " by:" + beforePos2.y);
            });

            AudioClip audioClip = LeanAudio.createAudio(new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(1f, 0f, -1f, 0f)), new AnimationCurve(new Keyframe(0f, 0.001f, 0f, 0f), new Keyframe(1f, 0.001f, 0f, 0f)), LeanAudio.options());

            LeanTween.delayedSound(gameObject, audioClip, new Vector3(0f, 0f, 0f), 0.1f).setDelay(0.2f).setOnComplete(() => {
                LeanTest.expect(Time.time > 0, "DELAYED SOUND");
            });

            StartCoroutine(timeBasedTesting());
        }
Beispiel #22
0
 public static LTDescr LTMoveLocalZ(this Transform self, float to, float time)
 {
     return(LeanTween.moveLocalZ(self.gameObject, to, time));
 }
Beispiel #23
0
 public static LTDescr LeanMoveLocalZ(this Transform transform, float to, float time)
 {
     return(LeanTween.moveLocalZ(transform.gameObject, to, time));
 }
Beispiel #24
0
 private void MoveBack(Vector3 pos)
 {
     LeanTween.moveLocalZ(gameObject, pos.z, ButtonTransitionTime)
     .setEase(ButtonEase);
 }
    /*
     * Method that carries out the selection sort algorithm. Also responsible for changes in colours and animations.
     */
    IEnumerator SelectionSortAlgorithm(GameObject[] unsortedList)
    {
        int        min;
        GameObject temp;
        Vector3    tempPosition;

        for (int i = 0; i < unsortedList.Length; i++)
        {
            // Current position being evaluated set to blue colour.
            LeanTween.color(unsortedList[i], Color.blue, 0);
            min = i;
            yield return(new WaitForSeconds(0.5f * AlgorithmDetails.Speed));

            for (int j = i + 1; j < unsortedList.Length; j++)
            {
                // Highlight the value thats currently being compared as cyan
                LeanTween.color(unsortedList[j], Color.cyan, 0);
                yield return(new WaitForSeconds(0.1f * AlgorithmDetails.Speed));

                // New lowest value found
                if (unsortedList[j].transform.localScale.y < unsortedList[min].transform.localScale.y)
                {
                    // If value isn't the initial value that was made blue, reset it to white.
                    if (min != i)
                    {
                        LeanTween.color(unsortedList[min], Color.white, 0);
                    }
                    min = j;
                    // Set lowest value seen sow far to red
                    LeanTween.color(unsortedList[j], Color.red, 0);
                    continue;
                }
                // Set the colour of the compared block back to white after comparison completed.
                LeanTween.color(unsortedList[j], Color.white, 0);
            }

            // Swap to be made, including animation.
            if (min != i)
            {
                // If one of the items in the swap is the block set to blue, set it back to white.
                LeanTween.color(unsortedList[i], Color.white, 1f);

                // Swap places in the array.
                temp              = unsortedList[i];
                unsortedList[i]   = unsortedList[min];
                unsortedList[min] = temp;

                tempPosition = unsortedList[i].transform.localPosition;

                // Using LeanTween for animations, swaps the cubes
                LeanTween.moveLocalX(unsortedList[i],
                                     unsortedList[min].transform.localPosition.x,
                                     1);

                LeanTween.moveLocalZ(unsortedList[i],
                                     -3,
                                     0.5f).setLoopPingPong(1);

                LeanTween.moveLocalX(unsortedList[min],
                                     tempPosition.x,
                                     1);

                LeanTween.moveLocalZ(unsortedList[min],
                                     3,
                                     0.5f).setLoopPingPong(1);

                LeanTween.color(unsortedList[i], Color.green, 1f);
                yield return(new WaitForSeconds(1f));

                continue;
            }
            LeanTween.color(unsortedList[i], Color.green, 1f);
        }
    }
Beispiel #26
0
        private void buildTween(LeanTweenItem item, float delayAdd, bool generateCode)
        {
            float delay = item.delay + delayAdd;
            bool  code  = generateCode;
            float d     = item.duration;

            // Debug.Log("item:"+item.action);
            if (item.action == TweenAction.ALPHA)
            {
                tween = code ? append("alpha", item.to.x, d) : LeanTween.alpha(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ALPHA_VERTEX)
            {
                tween = code ? append("alphaVertex", item.to.x, d) : LeanTween.alphaVertex(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE)
            {
                tween = code ? append("move", item.to, d) : LeanTween.move(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL)
            {
                tween = code ? append("moveLocal", item.to, d) : LeanTween.moveLocal(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_X)
            {
                tween = code ? append("moveLocalX", item.to.x, d) : LeanTween.moveLocalX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_Y)
            {
                tween = code ? append("moveLocalY", item.to.x, d) : LeanTween.moveLocalY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_Z)
            {
                tween = code ? append("moveLocalZ", item.to.x, d) : LeanTween.moveLocalZ(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_X)
            {
                tween = code ? append("moveX", item.to.x, d) : LeanTween.moveX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_Y)
            {
                tween = code ? append("moveY", item.to.x, d) : LeanTween.moveY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_Z)
            {
                tween = code ? append("moveZ", item.to.x, d) : LeanTween.moveZ(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_CURVED)
            {
                tween = code ? append("move", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.move(gameObject, item.bezierPath.vec3, d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.MOVE_CURVED_LOCAL)
            {
                tween = code ? append("moveLocal", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.moveLocal(gameObject, item.bezierPath.vec3, d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.MOVE_SPLINE)
            {
                tween = code ? append("moveSpline", item.splinePath ? item.splinePath.splineVector() : null, d) : LeanTween.moveSpline(gameObject, item.splinePath.splineVector(), d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.ROTATE)
            {
                tween = code ? append("rotate", item.to, d) : LeanTween.rotate(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.ROTATE_AROUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAround(gameObject, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAround(gameObject, item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.ROTATE_AROUND_LOCAL)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAroundLocal(gameObject, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAroundLocal(gameObject, item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.ROTATE_LOCAL)
            {
                tween = code ? append("rotateLocal", item.to, d) : LeanTween.rotateLocal(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.ROTATE_X)
            {
                tween = code ? append("rotateX", item.to.x, d) : LeanTween.rotateX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ROTATE_Y)
            {
                tween = code ? append("rotateY", item.to.x, d) : LeanTween.rotateY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ROTATE_Z)
            {
                tween = code ? append("rotateZ", item.to.x, d) : LeanTween.rotateZ(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE)
            {
                tween = code ? append("scale", item.to, d) : LeanTween.scale(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.SCALE_X)
            {
                tween = code ? append("scaleX", item.to.x, d) : LeanTween.scaleX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE_Y)
            {
                tween = code ? append("scaleY", item.to.x, d) : LeanTween.scaleY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE_Z)
            {
                tween = code ? append("scaleZ", item.to.x, d) : LeanTween.scaleZ(gameObject, item.to.x, d);
            }
                        #if !UNITY_4_3 && !UNITY_4_5
            else if (item.action == TweenAction.CANVAS_MOVE)
            {
                tween = code ? appendRect("move", item.to, d) : LeanTween.move(GetComponent <RectTransform>(), item.to, d);
            }
            else if (item.action == TweenAction.CANVAS_SCALE)
            {
                tween = code ? appendRect("scale", item.to, d) : LeanTween.scale(GetComponent <RectTransform>(), item.to, d);
            }
            else if (item.action == TweenAction.CANVAS_ROTATEAROUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAround(rectTransform, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAround(GetComponent <RectTransform>(), item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.CANVAS_ROTATEAROUND_LOCAL)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAroundLocal(rectTransform, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAroundLocal(GetComponent <RectTransform>(), item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.CANVAS_ALPHA)
            {
                tween = code ? appendRect("alpha", item.to.x, d) : LeanTween.alpha(GetComponent <RectTransform>(), item.to.x, d);
            }
            else if (item.action == TweenAction.CANVAS_COLOR)
            {
                tween = code ? appendRect("color", item.colorTo, d) : LeanTween.color(GetComponent <RectTransform>(), item.colorTo, d);
            }
            else if (item.action == TweenAction.TEXT_ALPHA)
            {
                tween = code ? appendRect("textAlpha", item.to.x, d) : LeanTween.textAlpha(GetComponent <RectTransform>(), item.to.x, d);
            }
            else if (item.action == TweenAction.TEXT_COLOR)
            {
                tween = code ? appendRect("textColor", item.colorTo, d) : LeanTween.textColor(GetComponent <RectTransform>(), item.colorTo, d);
            }
            else if (item.action == TweenAction.CANVAS_PLAYSPRITE)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.play(rectTransform, sprites).setFrameRate(" + item.frameRate + "f)");
                }
                else
                {
                    tween = LeanTween.play(GetComponent <RectTransform>(), item.sprites).setFrameRate(item.frameRate);
                }
            }
                        #endif
            else if (item.action == TweenAction.COLOR)
            {
                tween = code ? append("color", item.colorTo, d) : LeanTween.color(gameObject, item.colorTo, d);
            }
            else if (item.action == TweenAction.DELAYED_SOUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.delayedSound(gameObject, passAudioClipHere, " + vecToStr(item.from) + ", " + d + "f)");
                }
                else
                {
                    tween = LeanTween.delayedSound(gameObject, item.audioClip, item.from, item.duration);
                }
            }
            else
            {
                tween = null;
                Debug.Log("The tween '" + item.action.ToString() + "' has not been implemented. info item:" + item);
                return;
            }


            // Append Extras
            if (generateCode)
            {
                if (delay > 0f)
                {
                    codeBuild.Append(".setDelay(" + delay + "f)");
                }
            }
            else
            {
                tween = tween.setDelay(delay);
            }
            if (item.ease == LeanTweenType.animationCurve)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setEase(");
                    append(item.animationCurve);
                    codeBuild.Append(")");
                }
                else
                {
                    tween.setEase(item.animationCurve);
                }
            }
            else
            {
                if (generateCode)
                {
                    if (item.ease != LeanTweenType.linear)
                    {
                        codeBuild.Append(".setEase(LeanTweenType." + item.ease + ")");
                    }
                }
                else
                {
                    tween.setEase(item.ease);
                }
            }
            // Debug.Log("curve:"+item.animationCurve+" item.ease:"+item.ease);
            if (item.between == LeanTweenBetween.FromTo)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setFrom(" + item.from + ")");
                }
                else
                {
                    tween.setFrom(item.from);
                }
            }
            if (item.doesLoop)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setRepeat(" + item.loopCount + ")");
                }
                else
                {
                    tween.setRepeat(item.loopCount);
                }

                if (item.loopType == LeanTweenType.pingPong)
                {
                    if (generateCode)
                    {
                        codeBuild.Append(".setLoopPingPong()");
                    }
                    else
                    {
                        tween.setLoopPingPong();
                    }
                }
            }
            if (generateCode)
            {
                codeBuild.Append(";\n");
            }
        }