move() 공개 정적인 메소드

public static move ( GameObject gameObject, LTBezierPath, to, float time ) : LTDescr,
gameObject GameObject
to LTBezierPath,
time float
리턴 LTDescr,
예제 #1
0
    void Start()
    {
        LeanTest.timeout  = 45f;
        LeanTest.expected = 33;

        LeanTween.init(14 + 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();


        LTSpline cr = new LTSpline(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) });

        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);

        // OnStart Speed Test for ignoreTimeScale vs normal timeScale
        GameObject cube = Instantiate(boxNoCollider) as GameObject;

        cube.name = "normalTimeScale";
        // float timeElapsedNormal = Time.time;
        LeanTween.moveX(cube, 12f, 1f).setIgnoreTimeScale(false).setOnComplete(() => {
            timeElapsedNormalTimeScale = Time.time;
        });

        LTDescr[] descr = LeanTween.descriptions(cube);
        LeanTest.expect(descr.Length >= 0 && descr[0].to.x == 12f, "WE CAN RETRIEVE A DESCRIPTION");

        cube      = Instantiate(boxNoCollider) as GameObject;
        cube.name = "ignoreTimeScale";
        LeanTween.moveX(cube, 5f, 1f).setIgnoreTimeScale(true).setOnComplete(() => {
            timeElapsedIgnoreTimeScale = Time.time;
        });

        GameObject cubeDest = Instantiate(boxNoCollider) as GameObject;

        cubeDest.name = "cubeDest";
        Vector3 cubeDestEnd = new Vector3(100f, 20f, 0f);

        LeanTween.move(cubeDest, cubeDestEnd, 0.7f);
        GameObject cubeToTrans = Instantiate(boxNoCollider) as GameObject;

        cubeToTrans.name = "cubeToTrans";

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

        GameObject jumpCube = Instantiate(boxNoCollider) as GameObject;

        jumpCube.name = "jumpTime";
        int jumpTimeId = LeanTween.moveX(jumpCube, 1f, 1f).id;

        LeanTween.delayedCall(jumpCube, 0.2f, () => {
            LTDescr d     = LeanTween.descr(jumpTimeId);
            float beforeX = jumpCube.transform.position.x;
            d.setTime(0.5f);
            LeanTween.delayedCall(0.01f, () => { }).setOnStart(() => {
                LeanTest.expect(Mathf.Abs(jumpCube.transform.position.x - beforeX) < 0.01f, "CHANGING TIME DOESN'T JUMP AHEAD");
            });
        });

        StartCoroutine(timeBasedTesting());
    }
예제 #2
0
 void SetTarget(Vector3 pos)                                    // when shoot bomb, call from BombManager.cs
 {
     LeanTween.move(gameObject, pos, 0.5f).setOnComplete(Hide); // bomb move to pos, call Hide() when it complete
 }
    public void CharacterMovement()
    {
        MovementNode moveNode = this;

        MovementNode.SpotOnScreen scopedSpotOnScreen = moveNode.spotOnScreen;
        MovementNode.EnterOrLeave movementType       = moveNode.enterOrLeave;
        float _distance = CutsceneManager.Instance.MoveDistance;

        //manage face/outfit
        int _whichImage = 1;

        _whichImage = scopedSpotOnScreen.spotNumber();
        //SetSpriteOnScreen(_whichImage, scopedActor, scopedActor.baseClass.FaceID, scopedActor.baseClass.OutfitID);


        //setting up variables
        Image _image = CutsceneManager.Instance.rightCharacter;

        switch (_whichImage)
        {
        case 1:
            _image = CutsceneManager.Instance.leftCharacter;
            break;

        case 2:
            _image = CutsceneManager.Instance.midLeftCharacter;
            break;

        case 3:
            _image = CutsceneManager.Instance.midRightCharacter;
            break;

        case 4:
            _image = CutsceneManager.Instance.rightCharacter;
            break;
        }
        CharacterSprite charSprite = _image.GetComponent <CharacterSprite>();

        charSprite.IsMoving = true;

        charSprite = _image.GetComponent <CharacterSprite>();


        Vector3 _beginPoint = new Vector3(CutsceneManager.Instance.RightSpot.transform.position.x + _distance, _image.transform.position.y, _image.transform.position.z);
        Vector3 _endPoint   = new Vector3(CutsceneManager.Instance.RightSpot.position.x, _beginPoint.y, _beginPoint.z);

        float _lerpTime    = 0.5f;
        float _curLerpTime = 0f;

        charSprite.StartCoroutine(ResetMovingBool(_lerpTime, charSprite));

        Image _face   = charSprite.Face;
        Image _outfit = charSprite.Outfit;

        Color _faceColor   = _face.color;
        Color _outfitColor = _outfit.color;


        float _startOpacity = 0;
        float _endOpacity   = 1;

        float colorDim = 1f;

        if (!moveNode.IsSpeaking)
        {
            colorDim = 0.7f;
        }

        float _startDim = charSprite.Outfit.color.r;
        float _endDim   = colorDim;

        if (!scopedSpotOnScreen.IsRight())
        {
            Transform LeftSpot = CutsceneManager.Instance.LeftSpot;

            _beginPoint = new Vector3(LeftSpot.transform.position.x - _distance, _image.transform.position.y, _image.transform.position.z);
            _endPoint   = new Vector3(LeftSpot.position.x, _beginPoint.y, _beginPoint.z);
            // _endPoint = _beginPoint + Vector3.right * distance;
            if (scopedSpotOnScreen.IsMiddle())
            {
            }
        }
        else if (scopedSpotOnScreen.IsMiddle())
        {
        }

        bool inScene = false;

        if (movementType.IsLeaving())
        {
            Vector3 _newStart = new Vector3(_endPoint.x, _endPoint.y, _endPoint.z);
            Vector3 _newEnd   = new Vector3(_beginPoint.x, _endPoint.y, _endPoint.z);
            _beginPoint   = _newStart;
            _endPoint     = _newEnd;
            _startOpacity = 1f;
            _endOpacity   = 0f;
            CutsceneManager.Instance.activeImages.Remove(_outfit);
            CutsceneManager.Instance.activeImages.Remove(_face);
        }
        else
        {
            CutsceneManager.Instance.activeImages.Add(_outfit);
            CutsceneManager.Instance.activeImages.Add(_face);
            inScene = true;
        }
        //move
        _image.transform.position = _beginPoint;
        LeanTween.move(_image.gameObject, _endPoint, _lerpTime);
        // _face.color = new Color(1,1,1,0);
        // _outfit.color = new Color(1,1,1,0);

        LeanTween.value(_face.gameObject, new Color(_startDim, _startDim, _startDim, _startOpacity), new Color(_endDim, _endDim, _endDim, _endOpacity), _lerpTime).setOnUpdate(
            (Color val) =>
        {
            UnityEngine.UI.Image image = (UnityEngine.UI.Image)_face.gameObject.GetComponent(typeof(UnityEngine.UI.Image));
            image.color = val;
        }
            );
        LeanTween.value(_outfit.gameObject, new Color(_startDim, _startDim, _startDim, _startOpacity), new Color(_endDim, _endDim, _endDim, _endOpacity), _lerpTime).setOnUpdate(
            (Color val) =>
        {
            UnityEngine.UI.Image image = (UnityEngine.UI.Image)_outfit.gameObject.GetComponent(typeof(UnityEngine.UI.Image));
            image.color = val;
        }
            );
    }
예제 #4
0
 private void PickupAnim(GameObject interactor)
 {
     LeanTween.move(gameObject, interactor.transform, pickupAnimSpeed);
     LeanTween.scale(gameObject, new Vector3(0, 0), pickupAnimSpeed);
 }
예제 #5
0
    void SetupTweens()
    {
        // Ease
        DG.Tweening.Ease           dotweenEase = easing == Easing.Linear ? DG.Tweening.Ease.Linear : DG.Tweening.Ease.InOutQuad;
        Holoville.HOTween.EaseType hotweenEase = easing == Easing.Linear ? Holoville.HOTween.EaseType.Linear : Holoville.HOTween.EaseType.EaseInOutQuad;
        LeanTweenType leanEase = easing == Easing.Linear ? LeanTweenType.linear : LeanTweenType.easeInOutQuad;
        GoEaseType    goEase   = easing == Easing.Linear ? GoEaseType.Linear : GoEaseType.QuadInOut;

        iTween.EaseType iTweenEase = easing == Easing.Linear ? iTween.EaseType.linear : iTween.EaseType.easeInOutQuad;
        // Loop
        int loops = testSetup == TestSetup.Emit ? 1 : -1;

        DG.Tweening.LoopType       dotweenLoopType = testSetup == TestSetup.YoyoLoop ? DG.Tweening.LoopType.Yoyo : DG.Tweening.LoopType.Restart;
        Holoville.HOTween.LoopType hotweenLoopType = testSetup == TestSetup.YoyoLoop ? Holoville.HOTween.LoopType.Yoyo : Holoville.HOTween.LoopType.Restart;
        LeanTweenType leanLoopType = testSetup == TestSetup.YoyoLoop ? LeanTweenType.pingPong : LeanTweenType.clamp;
        GoLoopType    goLoopType   = testSetup == TestSetup.YoyoLoop ? GoLoopType.PingPong : GoLoopType.RestartFromBeginning;

        iTween.LoopType iTweenLoopType = loops != -1 ? iTween.LoopType.none : testSetup == TestSetup.YoyoLoop ? iTween.LoopType.pingPong : iTween.LoopType.loop;
        // Create tweens
        switch (testType)
        {
        case TestType.Floats:
            for (int i = 0; i < numTweens; ++i)
            {
                TestObjectData data = testObjsData[i];
                switch (engine)
                {
                case Engine.HOTween:
                    HOTween.To(data, duration, new Holoville.HOTween.TweenParms()
                               .Prop("floatValue", rndFloats[i])
                               .Ease(hotweenEase)
                               .Loops(loops, hotweenLoopType)
                               );
                    break;

                case Engine.LeanTween:
                    LeanTween.value(this.gameObject, x => data.floatValue = x, data.floatValue, rndFloats[i], duration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                    break;

                case Engine.GoKit:
                    Go.to(data, duration, new GoTweenConfig()
                          .floatProp("floatValueProperty", rndFloats[i])
                          .setEaseType(goEase)
                          .setIterations(loops, goLoopType)
                          );
                    break;

                case Engine.iTween:
                    Hashtable hs = new Hashtable();
                    hs.Add("from", data.floatValue);
                    hs.Add("to", rndFloats[i]);
                    hs.Add("time", duration);
                    hs.Add("onupdate", "UpdateiTweenFloat");
                    hs.Add("looptype", iTweenLoopType);
                    hs.Add("easetype", iTweenEase);
                    iTween.ValueTo(this.gameObject, hs);
                    break;

                default:
                    // tCopy is needed to create correct closure object,
                    // otherwise closure will pass the same t to all the loop
                    TestObjectData dataCopy = data;
                    DOTween.To(() => dataCopy.floatValue, x => dataCopy.floatValue = x, rndFloats[i], duration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                    break;
                }
            }
            break;

        default:
            for (int i = 0; i < numTweens; ++i)
            {
                float      twDuration = testSetup == TestSetup.Emit ? UnityEngine.Random.Range(0.25f, 1f) : duration;
                Transform  t          = testObjsTrans[i];
                GameObject go         = testObjsGos[i];         // Used by LeanTween and iTween
                switch (engine)
                {
                case Engine.HOTween:
                    Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms()
                                                      .Ease(hotweenEase)
                                                      .Loops(loops, hotweenLoopType);
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        tp.Prop("position", toPos);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenPositionFor(t, toPos, twDuration, hotweenEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        tp.Prop("rotation", toRot);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenRotationFor(t, toRot, twDuration, hotweenEase));
                        }
                    }
                    if (scaleTween)
                    {
                        tp.Prop("localScale", rndScale);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenScaleFor(t, rndScale, twDuration, hotweenEase));
                        }
                    }
                    HOTween.To(t, twDuration, tp);
                    break;

                case Engine.LeanTween:
                    LTDescr leanTween;
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        leanTween = LeanTween.move(go, rndPositions[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenPositionFor(t, go, toPos, twDuration, leanEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        leanTween = LeanTween.rotate(go, rndRotations[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenRotationFor(t, go, toRot, twDuration, leanEase));
                        }
                    }
                    if (scaleTween)
                    {
                        leanTween = LeanTween.scale(go, rndScale, twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenScaleFor(t, go, rndScale, twDuration, leanEase));
                        }
                    }
                    break;

                case Engine.GoKit:
                    GoTweenConfig goConfig = new GoTweenConfig()
                                             .setEaseType(goEase)
                                             .setIterations(loops, goLoopType);
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        goConfig.addTweenProperty(new PositionTweenProperty(toPos));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitPositionFor(t, toPos, twDuration, goEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        goConfig.addTweenProperty(new RotationTweenProperty(toRot));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitRotationFor(t, toRot, twDuration, goEase));
                        }
                    }
                    if (scaleTween)
                    {
                        goConfig.addTweenProperty(new ScaleTweenProperty(rndScale));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitScaleFor(t, rndScale, twDuration, goEase));
                        }
                    }
                    Go.to(t, twDuration, goConfig);
                    break;

                case Engine.iTween:
                    Hashtable hs;
                    if (positionTween)
                    {
                        hs = new Hashtable();
                        hs.Add("position", rndPositions[i]);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.MoveTo(go, hs);
                    }
                    if (rotationTween)
                    {
                        hs = new Hashtable();
                        hs.Add("rotation", rndRotations[i]);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.RotateTo(go, hs);
                    }
                    if (scaleTween)
                    {
                        hs = new Hashtable();
                        hs.Add("scale", rndScale);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.ScaleTo(go, hs);
                    }
                    break;

                default:
                    // tCopy is needed to create correct closure object,
                    // otherwise closure will pass the same t to all the loop
                    Transform         tCopy = t;
                    DG.Tweening.Tween dotween;
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        dotween = tCopy.DOMove(toPos, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenPositionFor(t, toPos, twDuration, dotweenEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        dotween = tCopy.DORotate(toRot, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenRotationFor(t, toRot, twDuration, dotweenEase));
                        }
                    }
                    if (scaleTween)
                    {
                        dotween = tCopy.DOScale(rndScale, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenScaleFor(t, rndScale, twDuration, dotweenEase));
                        }
                    }
                    break;
                }
            }
            break;
        }
    }
예제 #6
0
 public void PauseMenuClose()
 {
     LeanTween.move(PauseMenu.GetComponent <RectTransform>(), movePos[2], moveTime);
 }
예제 #7
0
 public LTDescr Open()
 {
     this.isOpen = true;
     LeanTween.cancel(this.target);
     return(LeanTween.move(this.target, this.openPoint.position, this.time));
 }
예제 #8
0
 public void PanRight()
 {
     m_CurrentPanel--;
     LeanTween.move(m_RectTransform, new Vector2(m_CurrentPanel * 1335f, 0), m_PanSpeed).setEaseInOutCubic();
 }
예제 #9
0
 public void CloseTutorial()
 {
     UIManager.m_Instance.m_ActiveUI = false;
     LeanTween.move(m_RectTransform, new Vector2(m_RectTransform.anchoredPosition.x, -1080), m_PanSpeed).setEaseInCubic().setOnComplete(ResetPosition);
     m_CurrentPanel = 0;
 }
예제 #10
0
 // when hit the knob the move up and down
 private void OnMoveUp()
 {
     LeanTween.move(this.gameObject, movePositionUp, 0.04f).setOnComplete(OnCompleteMoveUp);
 }
예제 #11
0
 private void OnMoveDown()
 {
     LeanTween.move(this.gameObject, movePositionDown, 0.04f).setOnComplete(OnCompleteMoveDown);
 }
예제 #12
0
 public void DisableSelf()
 {
     LeanTween.move(objectToTween, originalPos, timeToTween_out).setDelay(delayTime_out).setEase(easeOut).setOnComplete(SetActiveFalse);
 }
예제 #13
0
 public void PlayAnim(GameObject targetPos)
 {
     transform.Rotate(0, 0, 0 + Random.Range(-rotation, rotation));
     LeanTween.move(this.gameObject, targetPos.transform.position, 0f);
     anim.SetTrigger("pop");
 }
예제 #14
0
 // Use this for initialization
 void Start()
 {
     tween = LeanTween.move(gameObject, transform.position + Vector3.one * 3f, Random.Range(2, 2)).setRepeat(-1).setLoopClamp();
 }
예제 #15
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");
            }
        }
예제 #16
0
 public void OpenTutorial()
 {
     UIManager.m_Instance.m_ActiveUI = true;
     LeanTween.move(m_RectTransform, Vector2.zero, m_PanSpeed).setEaseInCubic();
 }
예제 #17
0
 public void MainMenuClose()
 {
     LeanTween.move(MainMenu.GetComponent <RectTransform>(), movePos[1], moveTime);
 }
예제 #18
0
 public void RaiseAltar()
 {
     LeanTween.move(altar, new Vector3(0, towerHeight * levelHeight, 0), altarRaiseTime).setEase(LeanTweenType.easeInOutQuad);
 }
예제 #19
0
 private void MoveAwayTween()
 {
     LeanTween.move(gameObject, transform.position + exhaleDelta, 1f).setEase(LeanTweenType.easeInOutQuad);
 }
예제 #20
0
 // Start is called before the first frame update
 void Start()
 {
     LeanTween.move(titleText, titleText.transform.position + new Vector3(0.0f, .5f, 0.0f), .5f).setLoopPingPong().setEaseInOutSine();
 }
예제 #21
0
 public LTDescr Close()
 {
     this.isOpen = false;
     LeanTween.cancel(this.target);
     return(LeanTween.move(this.target, this.closePoint.position, this.time));
 }
예제 #22
0
파일: BulletMove.cs 프로젝트: soykancali/TD
 private void Start()
 {
     LeanTween.move(this.gameObject, targePosition, 1f);
 }
예제 #23
0
 // Start is called before the first frame update
 void Start()
 {
     startButton.localScale = optionsButton.localScale = quitToDesktopButton.localScale = Vector3.zero;
     LeanTween.move(theMenu, new Vector3(150, 0, 0), time).setEaseInOutElastic().setOnComplete(OnMenuFinish);
 }
예제 #24
0
 public void LTMove(GameObject obj, Vector3 pos, float time, float tweenTime = 0.5f)
 {
     LeanTween.move(obj, pos, time).setEase(LeanTweenType.easeOutExpo).setTime(tweenTime);
     //LeanTween.move(obj, pos, time).setEase(LeanTweenType.easeInCubic).setTime(tweenTime);
 }
예제 #25
0
 void EmitLeanTweenPositionFor(Transform t, GameObject go, Vector3 to, float twDuration, LeanTweenType ease)
 {
     t.position = Vector3.zero;
     LeanTween.move(go, to, twDuration).setEase(ease).setOnComplete(() => EmitLeanTweenPositionFor(t, go, to, twDuration, ease));
 }
예제 #26
0
    void Update()
    {
        LeanTween.dtManual = Time.deltaTime;
        if (Input.GetKeyDown(KeyCode.Q))
        {
            //LeanTween.scale(this.gameObject, Vector3.one*3f, 1.0f).setEase(LeanTweenType.easeSpring).setUseManualTime(true);
            //print("scale punch time independent!");

            LeanTween.moveLocalX(gameObject, 5, 1).setOnComplete(() => {
                Debug.Log("on complete move local X");
            }).setOnCompleteOnStart(true);

            GameObject light = GameObject.Find("DirectionalLight");
            Light      lt    = light.GetComponent <Light>();

            LeanTween.value(lt.gameObject, lt.intensity, 0.0f, 1.5f)
            .setEase(LeanTweenType.linear)
            .setLoopPingPong()
            .setRepeat(-1)
            .setOnUpdate((float val) => {
                lt.intensity = val;
            });
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            print("scale punch!");

            tweenStatically(this.gameObject);

            LeanTween.scale(this.gameObject, new Vector3(1.15f, 1.15f, 1.15f), 0.6f);

            LeanTween.rotateAround(this.gameObject, Vector3.forward, -360f, 0.3f).setOnComplete(() =>
            {
                LeanTween.rotateAround(this.gameObject, Vector3.forward, -360f, 0.4f).setOnComplete(() =>
                {
                    LeanTween.scale(this.gameObject, new Vector3(1f, 1f, 1f), 0.1f);

                    LeanTween.value(this.gameObject, (v) =>
                    {
                    }, 0, 1, 0.3f).setDelay(1);
                });
            });
        }

        if (Input.GetKeyDown(KeyCode.T))
        {
            Vector3[] pts = new Vector3[] { new Vector3(-1f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(4f, 0f, 0f), new Vector3(20f, 0f, 0f) };
            descr = LeanTween.move(gameObject, pts, 15f).setOrientToPath(true).setDirection(1f).setOnComplete(() => {
                Debug.Log("move path finished");
            });
        }

        if (Input.GetKeyDown(KeyCode.Y)) // Reverse the move path
        {
            descr.setDirection(-descr.direction);
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            // LeanTween.rotate(this.gameObject, Vector3.one, 1.0f).setEase(LeanTweenType.punch);
            LeanTween.rotateAroundLocal(this.gameObject, this.transform.forward, -80f, 5.0f).setPoint(new Vector3(1.25f, 0f, 0f));
            print("rotate punch!");
        }

        if (Input.GetKeyDown(KeyCode.M))
        {
            // LeanTween.move(this.gameObject, new Vector3(0f,0f,1f), 1.0f).setEase(LeanTweenType.punch);
            print("move punch!");
            Time.timeScale = 0.25f;
            float start = Time.realtimeSinceStartup;
            LeanTween.moveX(this.gameObject, 1f, 1f).setOnComplete(destroyOnComp).setOnCompleteParam(this.gameObject).setOnComplete(() => {
                float end  = Time.realtimeSinceStartup;
                float diff = end - start;
                Debug.Log("start:" + start + " end:" + end + " diff:" + diff + " x:" + this.gameObject.transform.position.x);
            }).setEase(LeanTweenType.easeInBack).setOvershoot(overShootValue).setPeriod(0.3f);
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            LeanTween.color(this.gameObject, new Color(1f, 0f, 0f, 0.5f), 1f);

            Color      to = new Color(Random.Range(0f, 1f), 0f, Random.Range(0f, 1f), 0.0f);
            GameObject l  = GameObject.Find("LCharacter");
            LeanTween.color(l, to, 4.0f).setLoopPingPong(1).setEase(LeanTweenType.easeOutBounce);
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            LeanTween.delayedCall(gameObject, 0.3f, delayedMethod).setRepeat(4).setOnCompleteOnRepeat(true).setOnCompleteParam("hi");
        }

        if (Input.GetKeyDown(KeyCode.V))
        {
            LeanTween.value(gameObject, updateColor, new Color(1.0f, 0.0f, 0.0f, 1.0f), Color.blue, 4.0f);//.setRepeat(2).setLoopPingPong().setEase(LeanTweenType.easeOutBounce);
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            LeanTween.delayedCall(0.05f, enterMiniGameStart).setOnCompleteParam(new object[] { "" + 5 });
        }

        if (Input.GetKeyDown(KeyCode.U))
        {
            #if !UNITY_FLASH
            LeanTween.value(gameObject, (Vector2 val) => {
                // Debug.Log("tweening vec2 val:"+val);
                transform.position = new Vector3(val.x, transform.position.y, transform.position.z);
            }, new Vector2(0f, 0f), new Vector2(5f, 100f), 1f).setEase(LeanTweenType.easeOutBounce);

            GameObject l = GameObject.Find("LCharacter");
            Debug.Log("x:" + l.transform.position.x + " y:" + l.transform.position.y);
            LeanTween.value(l, new Vector2(l.transform.position.x, l.transform.position.y), new Vector2(l.transform.position.x, l.transform.position.y + 5), 1f).setOnUpdate(
                (Vector2 val) => {
                Debug.Log("tweening vec2 val:" + val);
                l.transform.position = new Vector3(val.x, val.y, transform.position.z);
            }

                );
            #endif
        }
    }
예제 #27
0
 private void Start()
 {
     tweenObject = LeanTween.move(gameObject, transform.position + (Vector3.up * distance), duration);
     tweenObject.setLoopPingPong();
     tweenObject.setEase(easeType);
 }
예제 #28
0
 public void HideHighComboMessage()
 {
     LeanTween.move(_highComboMsgGroup, _hideMsgPos, _timeToShowCombo).setEase(LeanTweenType.easeInCirc).setIgnoreTimeScale(true);
 }
예제 #29
0
 void ShowFunctionTypeButton()
 {
     LeanTween.move(FunctionTypeButton, new Vector2(w - (Padding + ButtonWidth), Padding), 0.3f).setEase(LeanTweenType.easeOutBack);
 }
예제 #30
0
    IEnumerator lotsOfCancels()
    {
        yield return(new WaitForEndOfFrame());

        Time.timeScale = 4f;
        int cubeCount = 10;

        int[]        tweensA = new int[cubeCount];
        GameObject[] aGOs    = new GameObject[cubeCount];
        for (int i = 0; i < aGOs.Length; i++)
        {
            GameObject cube = Instantiate(boxNoCollider) as GameObject;
            cube.transform.position = new Vector3(0, 0, i * 2f);
            cube.name  = "a" + i;
            aGOs[i]    = cube;
            tweensA[i] = LeanTween.move(cube, cube.transform.position + new Vector3(10f, 0, 0), 0.5f + 1f * (1.0f / (float)aGOs.Length)).id;
            LeanTween.color(cube, Color.red, 0.01f);
        }

        yield return(new WaitForSeconds(1.0f));

        int[]        tweensB = new int[cubeCount];
        GameObject[] bGOs    = new GameObject[cubeCount];
        for (int i = 0; i < bGOs.Length; i++)
        {
            GameObject cube = Instantiate(boxNoCollider) as GameObject;
            cube.transform.position = new Vector3(0, 0, i * 2f);
            cube.name  = "b" + i;
            bGOs[i]    = cube;
            tweensB[i] = LeanTween.move(cube, cube.transform.position + new Vector3(10f, 0, 0), 2f).id;
        }

        for (int i = 0; i < aGOs.Length; i++)
        {
            LeanTween.cancel(aGOs[i]);
            GameObject cube = aGOs[i];
            tweensA[i] = LeanTween.move(cube, new Vector3(0, 0, i * 2f), 2f).id;
        }

        yield return(new WaitForSeconds(0.5f));

        for (int i = 0; i < aGOs.Length; i++)
        {
            LeanTween.cancel(aGOs[i]);
            GameObject cube = aGOs[i];
            tweensA[i] = LeanTween.move(cube, new Vector3(0, 0, i * 2f) + new Vector3(10f, 0, 0), 2f).id;
        }

        for (int i = 0; i < bGOs.Length; i++)
        {
            LeanTween.cancel(bGOs[i]);
            GameObject cube = bGOs[i];
            tweensB[i] = LeanTween.move(cube, new Vector3(0, 0, i * 2f), 2f).id;
        }

        yield return(new WaitForSeconds(2.1f));

        bool inFinalPlace = true;

        for (int i = 0; i < aGOs.Length; i++)
        {
            if (Vector3.Distance(aGOs[i].transform.position, new Vector3(0, 0, i * 2f) + new Vector3(10f, 0, 0)) > 0.1f)
            {
                inFinalPlace = false;
            }
        }

        for (int i = 0; i < bGOs.Length; i++)
        {
            if (Vector3.Distance(bGOs[i].transform.position, new Vector3(0, 0, i * 2f)) > 0.1f)
            {
                inFinalPlace = false;
            }
        }

        LeanTest.expect(inFinalPlace, "AFTER LOTS OF CANCELS");
    }