rotateX() публичный статический Метод

public static rotateX ( GameObject gameObject, float to, float time ) : LTDescr,
gameObject GameObject
to float
time float
Результат LTDescr,
Пример #1
0
    public void use()
    {
        if (Inventory.Instance.bones >= upgrade.BoneCost && !used)
        {
            used = true;
            Inventory.Instance.setBones(-upgrade.BoneCost);
            upgrade.use();
            altarLight.color     = room.mainColor;
            altarLight.intensity = 2;
            playSFX(altarBuySFX, GetComponent <AudioSource>());

            // SWAP SPRITE TO "EMPTY SPRITE"
            spriteRend.sprite = null;

            // DISABLE DIALOG TEXT BOX
            UiManager.Instance.showText(false, "", 0, 0);

            // Squish & Strech GameObject for Feedback
            LeanTween.scale(hand, new Vector3(0.7f, 1.3f, 1), 0.4f).setEaseOutBack().setOnComplete(() =>
            {
                LeanTween.scale(hand, Vector3.one, 1).setEaseOutBounce().setOnComplete(() =>
                {
                    LeanTween.cancel(hand);
                    LeanTween.moveLocal(hand, new Vector3(0, 1.2f, -0.5f), 3f).setEaseInQuad();
                    LeanTween.rotateX(hand, 30f, 3f).setEaseInQuad();
                });
            });
        }
        else
        {
            // TODO ERROR MESSAGE
            UiManager.Instance.showErrorMessage(upgrade, 0.5f);
        }
    }
Пример #2
0
 public void Awake()
 {
     renderer = this.transform.FindChild("Cubic").GetComponent <SpriteRenderer>();
     LeanTween.rotateX(this.gameObject, 30, 0.9f)
     .setEase(LeanTweenType.easeShake)
     .setRepeat(-1);
 }
 public override void Attack_W()
 {
     base.Attack_W();
     animatorHero.SetTrigger(Constant.attackW);
     animatorHero.SetTrigger(Constant.idle);
     Delay(1.3f, () =>
     {
         GameObject hero_bullet = CreateObjectPool(bulletPrefab, bowObject.transform.position);
         //if (vector_competitor.x < 0) {
         //	hero_bullet.transform.localScale = new Vector3(hero_bullet.transform.localScale.x * -1, hero_bullet.transform.localScale.y);
         //}
         hero_bullet.GetComponent <SpriteRenderer>().sprite = listBullet[2];
         hero_bullet.transform.localScale = Vector3.one;
         if (BOL_Manager.instance.CanPlayMusicAndSfx())
         {
             MyAudioManager.instance.PlaySfx(sfx_sound_go);
         }
         LeanTween.move(hero_bullet, vector_competitor, 0.5f).setOnComplete(() =>
         {
             SelfDestruction_Object_Pool(hero_bullet);
             Auto_SelfDestruction_Object_Pool(ListFXSkill[2].gameObject, vector_competitor, 1f);
         });
         if (chairPositions == Constant.CHAIR_LEFT)
         {
             LeanTween.rotateX(hero_bullet, 180, 0.3f).setRepeat(-1);
         }
         else if (chairPositions == Constant.CHAIR_RIGHT)
         {
             LeanTween.rotateX(hero_bullet, 180, 0.3f).setRepeat(-1);
         }
     });
     ResetData();
 }
    public void setCountryActive(bool toggle)
    {
        //GameManager.log ("countryActive() - toggle: " + toggle);

        if (toggle)
        {
            LeanTween.move(countryPanel, countryMapLoc.transform.position, 2.0f).setEase(LeanTweenType.easeOutQuad);
            LeanTween.rotateX(countryPanel, countryMapLoc.transform.eulerAngles.x, 2.0f).setEase(LeanTweenType.easeOutQuad);

            LeanTween.move(worldCam, countryCamLoc.transform.position, 2.0f).setEase(LeanTweenType.easeOutQuad);
            LeanTween.rotateX(worldCam, countryCamLoc.transform.eulerAngles.x, 2.0f).setEase(LeanTweenType.easeOutQuad);

            LeanTween.moveLocalX(countryDetails, countryDetailsLocShow, 1.0f).setEase(LeanTweenType.easeOutQuad);

            if (countryLocked == false)
            {
                LeanTween.scale(countryDeployButton.GetComponent <RectTransform>(), new Vector3(1, 1, 1), 1.0f);
            }
        }
        else
        {
            LeanTween.move(countryPanel, countryMapOriginalLoc, 2.0f).setEase(LeanTweenType.easeOutQuad);
            LeanTween.rotateX(countryPanel, countryMapOriginalRot.x, 2.0f).setEase(LeanTweenType.easeOutQuad);

            LeanTween.moveLocalX(countryDetails, countryDetailsLocHidden, 1.0f);

            if (countryLocked == false)
            {
                LeanTween.scale(countryDeployButton.GetComponent <RectTransform>(), new Vector3(0, 0, 0), 1.0f);
            }
        }
    }
Пример #5
0
    //チュートリアルYesを選んだ時のアニメーション処理
    IEnumerator TVAnimation_TutoY()
    {
        //全てのTVのジョイントを90度回転
        LeanTween.rotateX(TV1Joint, 90, 1.0f);
        LeanTween.rotateX(TV2Joint, 90, 1.0f);
        LeanTween.rotateX(TV3Joint, 90, 1.0f);
        LeanTween.rotateX(TVTutoYJoin, 90, 1.0f);
        LeanTween.rotateX(TVTutoNJoin, 90, 1.0f);

        yield return(new WaitForSeconds(1.5f));

        //位置を下に下げて見えないように
        LeanTween.moveLocalY(TVs_Tutorial, TVs_Tutorial.transform.position.y - 5.0f, 1.0f);
        LeanTween.moveLocalY(TVs_Stage, TVs_Stage.transform.position.y - 5.0f, 1.0f);

        yield return(new WaitForSeconds(1.5f));

        //真ん中の左右のドアを開ける
        LeanTween.moveX(Door_Center_L, -4.45f, 1.5f);
        LeanTween.moveX(Door_Center_R, 5.0f, 1.5f);

        yield return(new WaitForSeconds(1.0f));

        //奥の左右のドアを開ける
        LeanTween.moveX(Door_L, -4.45f, 1.5f);
        LeanTween.moveX(Door_R, 5.0f, 1.5f);

        yield return(new WaitForSeconds(1.5f));

        //シーン遷移開始
        scene_Fade.LoadSceenWithFade();
    }
Пример #6
0
 public static LTDescr TweenRotateX(this Transform transform, float newX, float time = .3f,
                                    LeanTweenType easeType = LeanTweenType.easeOutExpo)
 {
     return(!transform
         ? null
         : LeanTween.rotateX(transform.gameObject, newX, time).setEase(easeType));
 }
 public void StartAnim()
 {
     LeanTween.rotateX(this.gameObject, 25.5f, 0.23f).setOnComplete(() => {
         LeanTween.rotateX(this.gameObject, -25.5f, 0.23f).setOnComplete(() => {
             StartAnim();
         });
     });
 }
Пример #8
0
 public void openTrapDoor()
 {
     foreach (GameObject trap in TrapDoor)
     {
         LeanTween.rotateX(trap, 90, 4).setEaseOutBounce();
         playSFX(trapDoorSFX, GetComponent <AudioSource>(), false);
     }
 }
Пример #9
0
 private void Start()
 {
     LeanTween.rotateX(objectToAnimate, to.x, duration);
     //if (showOnEnable)
     //{
     //    Show();
     //}
 }
Пример #10
0
    void shakePlayer()
    {
        Quaternion newPlayerRot = Quaternion.Euler(new Vector3(playerController.transform.rotation.eulerAngles.x, playerController.transform.rotation.eulerAngles.y + 10f, playerController.transform.rotation.eulerAngles.z));

        //LeanTween.moveLocalY(playerController,0.3f,0.25f).setLoopPingPong(1);;
        LeanTween.rotateX(handController, 5f, 0.25f).setLoopPingPong(1);;
        LeanTween.rotateX(plank, 3f, 0.25f).setLoopPingPong(1);;
    }
Пример #11
0
    public void Rotation()
    {
        LeanTween.cancel(target);
        RotationX = Random.Range(minRotation, maxRotation);
        RotationY = Random.Range(minRotation, maxRotation);

        LeanTween.rotateX(target, RotationX, duration).setLoopPingPong(1);
        LeanTween.rotateZ(target, RotationY, duration).setLoopPingPong(1).setOnComplete(InverseRotation);
    }
Пример #12
0
 public void RotateX()
 {
     Debug.Log("RotateX()");
     if (startPositionOffset)
     {
         objectToAnimate.GetComponent <Transform>().eulerAngles = from;
     }
     _tweenObject = LeanTween.rotateX(objectToAnimate, to.x, duration);
 }
Пример #13
0
 private void RotateX()
 {
     if (startOffset)
     {
         var rotation = _objRectTransform.rotation;
         rotation = Quaternion.Euler(floatFrom, rotation.y, rotation.z);
         _objRectTransform.rotation = rotation;
     }
     _tweenObject = LeanTween.rotateX(objectToAnimate, floatTo, duration);
 }
Пример #14
0
    private void RotateX()
    {
        _objRectTransform = _objectToAnimate.GetComponent <RectTransform>();
        if (_startPositionOffset)
        {
            _objRectTransform.rotation = Quaternion.Euler(_floatFrom, _objRectTransform.rotation.y, _objRectTransform.rotation.z);
        }

        _tweenObject = LeanTween.rotateX(_objectToAnimate, _floatTo, _duration);
    }
Пример #15
0
 public void UnflipWaffle() //unflips waffle - triggered by BoardTrigger
 {
     LeanTween.rotateX(gameObject, 90, 0.3f).setOnComplete(
         () => {
         GetComponent <SpriteRenderer>().sprite = waffles[0];
     }
         );
     LeanTween.rotateX(gameObject, 0, 0.3f).setDelay(0.3f);
     GetComponent <BoxCollider2D>().offset = new Vector2(0.01f, 0.02f);
     GetComponent <BoxCollider2D>().size   = new Vector2(2.4f, 2.4f);
 }
Пример #16
0
 public void tutorial1Done()
 {
     Debug.Log("Tutorial 1 is done");
     LeanTween.move(cam, camPos.transform.position, 2.0f).setDelay(0.1f).setEase(LeanTweenType.easeInOutSine);
     LeanTween.rotateX(cam, camPos.transform.localRotation.x, 2.0f).setDelay(0.1f).setEase(LeanTweenType.easeInOutSine);
     for (int i = 0; i < hides.Length; i++)
     {
         hides [i].GetComponent <HideTutorial> ().fadeIn();
         hides [i].GetComponent <HideTutorial> ().tutorialShake();
     }
     LeanTween.move(tutorialWindow, camPos.transform.position, 1.0f).setDelay(1.0f).setEase(LeanTweenType.easeInSine);
 }
Пример #17
0
    private IEnumerator WaitAndSpawn(float waitTime)
    {
        yield return(new WaitForSeconds(waitTime));

        for (int i = 0; i < spawners.Length; i++)
        {
            GameObject gameObject;
            gameObject = (GameObject)Instantiate(weapons[Random.Range(0, 4)], spawners[i].transform.position, Quaternion.identity);
            gameObject.transform.SetParent(GameObject.FindGameObjectWithTag("Cart").transform);
            gameObject.transform.localScale = new Vector3(1.7f, 1.5f, 1.5f);
            LeanTween.rotateX(gameObject, -75, 1f).setEaseInOutSine();
            LeanTween.rotateY(gameObject, 80, 1f).setEaseInOutSine();
            LeanTween.rotateZ(gameObject, -70, 1f).setEaseInOutSine();
        }
    }
Пример #18
0
        private IEnumerator MoveEnumerator(Vector3 position, Quaternion rotation)
        {
            LeanTween.init(1200);
            var seq = LeanTween.sequence();

            seq.append(LeanTween.moveLocalY(gameObject, transform.localPosition.y + liftAmount, 0.5f).setEaseOutQuad());
            seq.append(LeanTween.move(gameObject, position, 0.5f).setEaseOutQuad());
            LeanTween.rotateX(gameObject, rotation.eulerAngles.x, 0.5f);
            LeanTween.rotateY(gameObject, rotation.eulerAngles.y, 0.5f);
            seq.append(() =>
            {
                isAnimating = false;
            });
            yield return(null);
        }
Пример #19
0
        private void OnGameStateHander(GameStateMessage gameStateMessage)
        {
            if (gameStateMessage.GameState == GameState.Launch || gameStateMessage.GameState == GameState.Menu)
            {
                gameObject.SetActive(true);
                _Shield.IncreaseEnergy(_Shield.MaxEnergy);
                transform.position = Vector3.zero;
                transform.rotation = Quaternion.identity;
            }

            if (gameStateMessage.GameState == GameState.Launch)
            {
                transform.localRotation = Quaternion.Euler(-10, 0, 0); // ...
                LeanTween.rotateX(gameObject, 10f, 3f).setRecursive(true).setLoopPingPong();
            }
        }
Пример #20
0
 //レーザー攻撃
 void BossAttack_Laser()
 {
     isOnlyRotate = false;
     //攻撃が始まっていなければ
     if (laserStart == false)
     {
         //正面を向ける
         LeanTween.rotate(this.gameObject, new Vector3(0.0f, 180.0f, 0.0f), 1.0f).setOnComplete(() =>
         {
             //斜め上を向ける
             LeanTween.rotateX(this.gameObject, -45.0f, 1.5f).setOnComplete(() =>
             {
                 //レーザー発射位置に移動
                 LeanTween.move(this.gameObject, laserAttackPos.position, 2.5f).setOnComplete(() =>
                 {
                     //斜め下を向ける
                     LeanTween.rotateX(this.gameObject, 60.0f, 2.0f).setOnComplete(() =>
                     {
                         //レーザー発射
                         StartCoroutine(LaserShot());
                     });
                 });
             });
         });
         laserStart = true;
     }
     //レーザー攻撃が終了したら
     if (laserEnd == true)
     {
         //斜め後ろ下を向ける
         LeanTween.rotate(this.gameObject, new Vector3(120.0f, 180.0f, 0.0f), 2.0f).setOnComplete(() =>
         {
             //ボス初期位置に移動
             LeanTween.move(this.gameObject, bossDefaultPos, 2.5f).setOnComplete(() =>
             {
                 //正面を向かせる
                 LeanTween.rotate(this.gameObject, new Vector3(0, 180, 0), 2.0f).setOnComplete(() =>
                 {
                     laserStart     = false;
                     laserStartTime = 60.0f;
                     bossState      = BossState.Stop;
                 });
             });
         });
         laserEnd = false;
     }
 }
Пример #21
0
    //チュートリアルNoを選んだ時のアニメーション処理
    IEnumerator TVAnimation_TutoN()
    {
        //チュートリアル選択TVのジョイントを90度回転
        LeanTween.rotateX(TVTutoYJoin, 90, 1.0f);
        LeanTween.rotateX(TVTutoNJoin, 90, 1.0f);

        yield return(new WaitForSeconds(1.5f));

        //チュートリアルのTVの位置を下げて見えないように
        LeanTween.moveLocalY(TVs_Tutorial, TVs_Tutorial.transform.position.y - 5.0f, 1.0f);

        yield return(new WaitForSeconds(1.5f));

        //真ん中の左右のドアを開く
        LeanTween.moveX(Door_Center_L, -4.45f, 1.5f);
        LeanTween.moveX(Door_Center_R, 5.0f, 1.5f);
    }
Пример #22
0
    //ステージ選択TVのアニメーション処理
    IEnumerator TVAnimation_Stage()
    {
        //3つのTVジョイントを90度回転
        LeanTween.rotateX(TV1Joint, 90, 1.0f);
        LeanTween.rotateX(TV2Joint, 90, 1.0f);
        LeanTween.rotateX(TV3Joint, 90, 1.0f);

        yield return(new WaitForSeconds(1.5f));

        //ステージ選択のテレビの親オブジェクトの位置を下に下げて見えない位置に
        LeanTween.moveLocalY(TVs_Stage, TVs_Stage.transform.position.y - 5.0f, 1.0f);

        yield return(new WaitForSeconds(1.5f));

        //奥の左右のドアを開ける
        LeanTween.moveX(Door_L, -4.45f, 1.5f);
        LeanTween.moveX(Door_R, 5.0f, 1.5f);

        yield return(new WaitForSeconds(1.5f));

        //シーン遷移開始
        scene_Fade.LoadSceenWithFade();
    }
Пример #23
0
        // Code that runs on entering the state.
        public override void OnEnter()
        {
            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);

            Fsm.Event(onStartEvent);
            LTDescr tween = LeanTween.rotateX(go, rotation.Value, time.Value);

            LeanTweenID.Value = tween.id;

            tween.setEase(easeType);
            tween.setDelay(delay.Value);

            if (noOfRepeat.Value > 0)
            {
                tween.setRepeat(noOfRepeat.Value);
            }

            switch (LoopType)
            {
            case LTLoop.clamp:
                tween.setLoopClamp();
                break;

            case LTLoop.once:
                tween.setLoopOnce();
                break;

            case LTLoop.pingpong:
                tween.setLoopPingPong();
                break;
            }

            tween.setOnComplete(doOnComplete);
            tween.setOnUpdate(doOnUpdate);
            tween.setUseEstimatedTime(useEstimatedTime.Value);
            tween.setUseFrames(useFrames.Value);
        }
Пример #24
0
 private void CollapseInDirection()
 {
     if (axeHitPoint.z < 0.5 && axeHitPoint.z > -0.5)
     {
         if (axeHitPoint.z > 0)
         {
             collapseAngle = -88;
         }
         else
         {
             collapseAngle = 88;
         }
         foreach (Rigidbody child in treeParts)
         {
             LeanTween.rotateX(this.gameObject, collapseAngle, 1.5f);
             child.isKinematic = false;
         }
         return;
     }
     else if (axeHitPoint.x > -0.5 && axeHitPoint.x < 0.5)
     {
         if (axeHitPoint.x > 0)
         {
             collapseAngle = 88;
         }
         else
         {
             collapseAngle = -88;
         }
         foreach (Rigidbody child in treeParts)
         {
             LeanTween.rotateZ(this.gameObject, collapseAngle, 1.5f);
             child.isKinematic = false;
         }
         return;
     }
 }
Пример #25
0
 public static LTDescr LeanRotateX(this Transform transform, float to, float time)
 {
     return(LeanTween.rotateX(transform.gameObject, to, time));
 }
Пример #26
0
 //LeanTween.rotateLocal
 //LeanTween.rotateX
 public static LTDescr LeanRotateX(this GameObject gameObject, float to, float time)
 {
     return(LeanTween.rotateX(gameObject, to, time));
 }
Пример #27
0
 public void InverseRotation()
 {
     LeanTween.rotateX(target, -RotationX, duration).setLoopPingPong(1);
     LeanTween.rotateZ(target, -RotationY, duration).setLoopPingPong(1).setOnComplete(Rotation);
 }
        ////////////////////////////////////////////////////////////////////////
        // Static Methods


        public static void AnimateData(BridgeObject bridgeObject, JArray dataArray)
        {
            GameObject go = bridgeObject.gameObject;

            if (leanTweenBridge == null)
            {
                Debug.LogError("LeanTweenBridge: AnimateData: no leanTweenBridge has been created.");
                return;
            }

            foreach (JObject data in dataArray)
            {
                LTDescr    result = null;
                GameObject target = go;

                float time = 1.0f;
                if (data.ContainsKey("time"))
                {
                    time = data.GetFloat("time");
                    if (time <= 0.0f)
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: time must be > 0. data: " + data);
                        return;
                    }
                }

                if (data.ContainsKey("target"))
                {
                    string targetPath = data.GetString("target");

                    if (targetPath == "")
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: empty targetPath");
                        return;
                    }

                    Accessor accessor = null;
                    if (!Accessor.FindAccessor(
                            bridgeObject,
                            targetPath,
                            ref accessor))
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: target: can't find accessor for targetPath: " + targetPath);
                        return;
                    }

                    object obj = null;
                    if (!accessor.Get(ref obj))
                    {
                        if (!accessor.conditional)
                        {
                            Debug.LogError("LeanTweenBridge: AnimateData: target: can't get accessor: " + accessor + " targetPath: " + targetPath);
                            return;
                        }
                    }

                    GameObject goTarget = obj as GameObject;
                    if (goTarget == null)
                    {
                        Transform xform = obj as Transform;
                        if (xform != null)
                        {
                            goTarget = xform.gameObject;
                        }
                        else
                        {
                            Component component = obj as Component;
                            if (component != null)
                            {
                                goTarget = component.gameObject;
                            }
                        }
                    }

                    if (goTarget == null)
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: null targetPath: " + targetPath + " obj: " + obj);
                        return;
                    }

                    //Debug.Log("LeanTweenBridge: AnimateData: targetPath: " + targetPath + " goTarget: " + goTarget);
                    target = goTarget;
                }

                var command = (string)data.GetString("command");
                if (string.IsNullOrEmpty(command))
                {
                    Debug.LogError("LeanTweenBridge: AnimateData: missing command from data: " + data);
                    return;
                }

                switch (command)
                {
                case "init":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "play":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "cancel":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "cancelAll":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "pause":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "pauseAll":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "resume":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "resumeAll":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "sequence":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "value":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "move":
                case "moveLocal":
                case "moveSpline":
                case "moveSplineLocal":

                    //Debug.Log("LeanTweenBridge: AnimateData: command: " + command + " data: " + data);

                    // TODO: handle RectTransform instead of GameObject

                    if (data.ContainsKey("position"))
                    {
                        Vector3 position = Vector3.zero;
                        if (!Bridge.mainBridge.ConvertToType <Vector3>(data["position"], ref position))
                        {
                            Debug.LogError("LeanTweenBridge: AnimateData: position must be a Vector3. data: " + data);
                            return;
                        }

                        switch (command)
                        {
                        case "move":
                            result = LeanTween.move(target, position, time);
                            break;

                        case "moveLocal":
                            result = LeanTween.moveLocal(target, position, time);
                            break;

                        case "moveSpline":
                        case "moveSplineLocal":
                            Debug.LogError("LeanTweenBridge: AnimateData: position not supported for " + command + ". data: " + data);
                            return;
                        }
                    }
                    else if (data.ContainsKey("transform"))
                    {
                        Transform xform = null;

                        string path = data.GetString("transform");

                        Accessor accessor = null;
                        if (!Accessor.FindAccessor(
                                bridgeObject,
                                path,
                                ref accessor))
                        {
                            Debug.LogError("LeanTweenBridge: AnimateData: transform must be a path. path: " + path + " data: " + data);
                            return;
                        }
                        object val = null;
                        if (!accessor.Get(ref val) ||
                            (val == null))
                        {
                            Debug.LogError("LeanTweenBridge: AnimateData: error getting path to transform. path: " + path + " data: " + data);
                            return;
                        }

                        xform = val as Transform;

                        if (xform == null)
                        {
                            Debug.LogError("LeanTweenBridge: AnimateData: path does not point to transform. path: " + path + " data: " + data);
                            return;
                        }

                        switch (command)
                        {
                        case "move":
                            result = LeanTween.move(target, xform, time);
                            break;

                        case "moveLocal":
                        case "moveSpline":
                        case "moveSplineLocal":
                            Debug.LogError("LeanTweenBridge: AnimateData: transform not supported for " + command + ". data: " + data);
                            return;
                        }
                    }
                    else if (data.ContainsKey("path"))
                    {
                        Vector3[] path = null;
                        if (!Bridge.mainBridge.ConvertToType <Vector3[]>(data["path"], ref path))
                        {
                            Debug.LogError("LeanTweenBridge: AnimateData: path must be an Vector3[]. data: " + data);
                            return;
                        }

                        switch (command)
                        {
                        case "move":
                            result = LeanTween.move(target, path, time);
                            break;

                        case "moveLocal":
                            result = LeanTween.moveLocal(target, path, time);
                            break;

                        case "moveSpline":
                            result = LeanTween.moveSpline(target, path, time);
                            break;

                        case "moveSplineLocal":
                            result = LeanTween.moveSplineLocal(target, path, time);
                            break;
                        }
                    }
                    else if (data.ContainsKey("spline"))
                    {
                        LTSpline spline = null;
                        if (!Bridge.mainBridge.ConvertToType <LTSpline>(data["spline"], ref spline))
                        {
                            Debug.LogError("LeanTweenBridge: AnimateData: spline must be a LTSpline. data: " + data);
                            return;
                        }

                        switch (command)
                        {
                        case "moveSpline":
                            result = LeanTween.moveSpline(target, spline, time);
                            break;

                        case "move":
                        case "moveLocal":
                        case "moveSplineLocal":
                            Debug.LogError("LeanTweenBridge: AnimateData: spline not supported for " + command + ". data: " + data);
                            break;
                        }
                    }
                    else
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: command: " + command + " should contain position, transform, path or spline. data: " + data);
                        return;
                    }

                    break;

                case "moveX":
                case "moveY":
                case "moveZ":

                    // TODO: handle RectTransform instead of GameObject

                    if (!data.ContainsKey("to"))
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: missing to parameter. data: " + data);
                        return;
                    }

                    float moveTo = data.GetFloat("to");

                    switch (command)
                    {
                    case "moveX":
                        result = LeanTween.moveX(target, moveTo, time);
                        break;

                    case "moveY":
                        result = LeanTween.moveY(target, moveTo, time);
                        break;

                    case "moveZ":
                        result = LeanTween.moveZ(target, moveTo, time);
                        break;
                    }

                    break;

                case "rotate":
                case "rotateLocal":

                    //Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);

                    // TODO: handle RectTransform instead of GameObject

                    if (!data.ContainsKey("to"))
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: missing to. data: " + data);
                        return;
                    }

                    Vector3 rotateTo = Vector3.zero;
                    if (!Bridge.mainBridge.ConvertToType <Vector3>(data["to"], ref rotateTo))
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: to must be an Vector3. data: " + data);
                        return;
                    }

                    switch (command)
                    {
                    case "rotate":
                        result = LeanTween.rotate(target, rotateTo, time);
                        break;

                    case "rotateLocal":
                        result = LeanTween.rotateLocal(target, rotateTo, time);
                        break;
                    }

                    break;

                case "rotateX":
                case "rotateY":
                case "rotateZ":

                    //Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);

                    // TODO: handle RectTransform instead of GameObject

                    if (!data.ContainsKey("to"))
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: missing to. data: " + data);
                        return;
                    }

                    float rotateToValue = data.GetFloat("to");

                    switch (command)
                    {
                    case "rotateX":
                        result = LeanTween.rotateX(target, rotateToValue, time);
                        break;

                    case "rotateY":
                        result = LeanTween.rotateY(target, rotateToValue, time);
                        break;

                    case "rotateZ":
                        result = LeanTween.rotateZ(target, rotateToValue, time);
                        break;
                    }

                    break;

                case "rotateAround":
                case "rotateAroundLocal":

                    //Debug.Log("LeanTweenBridge: AnimateData: command: " + command + " data: " + data);

                    // TODO: handle RectTransform instead of GameObject

                    if (!data.ContainsKey("axis"))
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: missing axis. data: " + data);
                        return;
                    }

                    if (!data.ContainsKey("to"))
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: missing to. data: " + data);
                        return;
                    }

                    Vector3 rotateAroundAxis = Vector3.zero;
                    if (!Bridge.mainBridge.ConvertToType <Vector3>(data["axis"], ref rotateAroundAxis))
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: to must be an Vector3. data: " + data);
                        return;
                    }

                    float rotateAroundTo = data.GetFloat("to");

                    switch (command)
                    {
                    case "rotateAround":
                        result = LeanTween.rotateAround(target, rotateAroundAxis, rotateAroundTo, time);
                        break;

                    case "rotateLocalLocal":
                        result = LeanTween.rotateAroundLocal(target, rotateAroundAxis, rotateAroundTo, time);
                        break;
                    }

                    break;

                case "scale":

                    //Debug.Log("LeanTweenBridge: AnimateData: command: " + command + " data: " + data);

                    // TODO: handle RectTransform instead of GameObject

                    if (!data.ContainsKey("to"))
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: missing to. data: " + data);
                        return;
                    }

                    Vector3 to      = Vector3.one;
                    JToken  toToken = data["to"];
                    if (toToken.IsNumber())
                    {
                        float s = (float)toToken;
                        to = new Vector3(s, s, s);
                    }
                    else if (toToken.IsObject())
                    {
                        if (!Bridge.mainBridge.ConvertToType <Vector3>(toToken, ref to))
                        {
                            Debug.LogError("LeanTweenBridge: AnimateData: error converting to object to Vector3. data: " + data);
                            return;
                        }
                    }
                    else
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: to should be number or object. toToken: " + toToken + " " + toToken.Type + " data: " + data);
                        return;
                    }

                    result = LeanTween.scale(target, to, time);

                    break;

                case "scaleX":
                case "scaleY":
                case "scaleZ":

                    //Debug.Log("LeanTweenBridge: AnimateData: command: " + command + " data: " + data);

                    if (!data.ContainsKey("to"))
                    {
                        Debug.LogError("LeanTweenBridge: AnimateData: missing to. data: " + data);
                        return;
                    }

                    float scaleTo = data.GetFloat("to");

                    switch (command)
                    {
                    case "scaleX":
                        result = LeanTween.scaleX(target, scaleTo, time);
                        break;

                    case "scaleY":
                        result = LeanTween.scaleY(target, scaleTo, time);
                        break;

                    case "scaleZ":
                        result = LeanTween.scaleZ(target, scaleTo, time);
                        break;
                    }

                    break;

                case "size":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    // TODO: handle RectTransform but not GameObject
                    break;

                case "alpha":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "color":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                case "colorText":
                    Debug.Log("LeanTweenBridge: AnimateData: TODO: command: " + command + " data: " + data);
                    break;

                default:
                    Debug.LogError("LeanTweenBridge: AnimateData: unknown command: " + command + " in data: " + data);
                    return;
                }

                if (result != null)
                {
/*
 *              pause
 *              resume
 *              axis
 *              delay
 *              direction
 *              ease
 *              from
 *              ignoreTimeScale
 *              loopClamp
 *              loopOnce
 *              loopPingPong
 *              onComplete
 *              onCompleteOnRepeat
 *              onCompleteOnStart
 *              onCompleteParam
 *              onStart
 *              onUpdate
 *              onUpdateParam
 *              orientToPath
 *              orientToPath2d
 *              overshoot
 *              passed
 *              period
 *              point
 *              recursive
 *              repeat
 *              scale
 *              speed
 *              time
 *              to
 *              useFrames
 *              updateNow
 */
                }
            }
        }
Пример #29
0
 public static void RotateToX(GameObject obj, float x, float duration, LeanTweenType easetype = LeanTweenType.linear)
 {
     LeanTween.rotateX(obj, x, duration).setEase(easetype);
 }
Пример #30
0
    void ShowPopUpModeArcade(int time, bool isNormal)
    {
        Arcade.SetActive(true);
        TopScore.SetActive(false);
        Level.SetActive(true);
        foreach (var item in LevelText)
        {
            item.sprite = null;
        }

        Stars.SetActive(true);
        LeanTween.rotateX(Stars, 1f, 0.15f);
        Retry.gameObject.SetActive(true);
        if (time < 2 * GameData.TIMERATE)
        {
            Star[0].gameObject.SetActive(true);
            Star[1].gameObject.SetActive(true);
            Star[2].gameObject.SetActive(true);
        }
        else if (time < 3 * GameData.TIMERATE)
        {
            Star[0].gameObject.SetActive(true);
            Star[1].gameObject.SetActive(true);
        }
        else
        {
            Star[0].gameObject.SetActive(true);
        }
        int currentLevel = SceneManager.instance.CurrentLevel + 1;

        if (!isNormal)
        {
            currentLevel -= 1;
        }
        var temp = currentLevel.ToString();

        for (int i = 0; i < temp.Length; i++)
        {
            var ind = int.Parse(temp[i].ToString());
            LevelText[i].sprite = Number[ind];
            LevelText[i].SetNativeSize();
        }

        if (currentLevel >= SceneManager.instance.MapNumber * SceneManager.instance.LevelPerMap)
        {
            currentLevel = SceneManager.instance.MapNumber * SceneManager.instance.LevelPerMap;
        }
        if (currentLevel % SceneManager.instance.NumberLevelShowPopUp == 0 && currentLevel > 0)
        {
            SceneManager.instance.PopUpRateController.ShowPopUpRate();
        }

        var best = time;
        //var data = SceneManager.instance.GetMapData(SceneManager.instance.CurrentLevel);
        var data = MaxScore;

        if (time < data || data == 0)
        {
            Record.color = new Color(1, 1, 1, 1);
            PlayerPrefs.SetInt("BEST_SCORE", best);
            MaxScore = best;
        }
        else
        {
            Record.color = new Color(1, 1, 1, 0);
            best         = data;
        }

        var min = time / 60;
        var sec = time % 60;

        TimeScore[0].sprite = min < 10 ? Number[0] : Number[min / 10];
        TimeScore[1].sprite = Number[min % 10];
        TimeScore[2].sprite = sec < 10 ? Number[0] : Number[sec / 10];
        TimeScore[3].sprite = Number[sec % 10];

        var min2 = data / 60;
        var sec2 = data % 60;

        BestScore[0].sprite = min2 < 10 ? Number[0] : Number[min2 / 10];
        BestScore[1].sprite = Number[min2 % 10];
        BestScore[2].sprite = sec2 < 10 ? Number[0] : Number[sec2 / 10];
        BestScore[3].sprite = Number[sec2 % 10];
    }