isTweening() public static method

public static isTweening ( GameObject gameObject = null ) : bool
gameObject GameObject
return bool
Esempio n. 1
0
 private void CancelDelayedCall()
 {
     if (LeanTween.isTweening(_delayedCallId))
     {
         LeanTween.cancel(_delayedCallId);
     }
 }
Esempio n. 2
0
    public override void Action3()
    {
        //Shoot Snakes
        if (moveID != 0)
        {
            if (LeanTween.isTweening(moveID))
            {
                return;
            }
        }

        int r   = Random.Range(0, MovePoints.Count - 1);
        var seq = LeanTween.sequence();

        moveID = seq.id;
        seq.append(LeanTween.scale(gameObject, Vector3.zero, 0.4f));
        seq.append(2f);
        seq.append(() => gameObject.transform.position = MovePoints[r].position);
        seq.append(LeanTween.scale(gameObject, Vector3.one, 0.4f));

        r = Random.Range(0, SlitherPoints.Count - 1);
        GameObject sliterGO = Instantiate(prefab_Slither, null);

        prefab_Slither.transform.position = SlitherPoints[r].position;
        prefab_Slither.transform.rotation = SlitherPoints[r].rotation;
    }
Esempio n. 3
0
    public void UpdateText()
    {
        if (playerNumber == 1)
        {
            distance = ScoreCounter.Instance.Distance1;
        }
        else if (playerNumber == 2)
        {
            distance = ScoreCounter.Instance.Distance2;
        }

        if (distance != previousDistance)
        {
            if (transform.localScale != targetScale && !LeanTween.isTweening(scalingUp))
            {
                // Cancel scaling down and scale up
                LeanTween.cancel(scalingDown);
                scalingUp = LeanTween.scale(gameObject, targetScale, scaleDuration).setEase(LeanTweenType.easeInOutCubic).id;
            }
            // Update the text element with the new distance
            distanceText.text = distance.ToString();
        }
        else if (!LeanTween.isTweening(gameObject) && transform.localScale != originalCounterScale)
        {
            // Scale down
            scalingDown = LeanTween.scale(gameObject, originalCounterScale, scaleDuration).setEase(LeanTweenType.easeInOutCubic).id;
        }
    }
    public void OnPointerUp(PointerEventData evd)
    {
        if (isDisabled)
        {
            return;
        }

        //LeanTween.scale (gameObject, new Vector3 (startSize.x * scaleToPercentOnUp, startSize.y * scaleToPercentOnUp, startSize.z * scaleToPercentOnUp), scaleTime);

        if (Vector3.Distance(Camera.main.ScreenToWorldPoint(Input.mousePosition), startPos) > 0.1f)
        {
            isClick = false;
        }

        if (isClick && !LeanTween.isTweening(Camera.main.gameObject))
        {
            startAction();
            if (disableAfterClick)
            {
                disableButton();
                return;
            }
            isClick = false;
        }

        if (isHovering)
        {
            mixColors(hoverColorAdd);
        }
        else
        {
            mixColors();
        }
    }
Esempio n. 5
0
        private void Update()
        {
            switch (ability.CurrentStage)
            {
            case AbilityStage.Idle:
                if (!LeanTween.isTweening(gameObject))
                {
                    LeanTween.scale(gameObject, bounceScale, bounceDuration * 0.5f);
                    LeanTween.scale(gameObject,
                                    Vector3.one,
                                    bounceDuration * 0.5f).setDelay(bounceDuration * 0.5f);
                }
                break;

            case AbilityStage.Active:
                abilityImage.fillMethod = Image.FillMethod.Vertical;
                abilityImage.fillAmount = ability.AbilityProgress;
                break;

            case AbilityStage.Cooldown:
                abilityImage.fillMethod = Image.FillMethod.Radial360;
                abilityImage.fillAmount = 1f - ability.CooldownProgress;
                break;
            }
        }
Esempio n. 6
0
    /// <summary>
    /// Checks if any of the texts are currently being animated.
    /// </summary>
    private void CheckForTextMovement()
    {
        if (!LeanTween.isTweening(_goodJob.gameObject) && _goodjobTimer.IsCompleted)
        {
            _goodJob.gameObject.SetActive(false);
            _goodJob.rectTransform.localPosition   = Vector2.zero;
            _unbelievable.rectTransform.localScale = Vector2.one;
        }

        if (!LeanTween.isTweening(_amazing.gameObject) && _amazingTimer.IsCompleted)
        {
            _amazing.gameObject.SetActive(false);
            _amazing.rectTransform.localPosition   = Vector2.zero;
            _unbelievable.rectTransform.localScale = Vector2.one;
        }
        if (!LeanTween.isTweening(_incredible.gameObject) && _incredibleTimer.IsCompleted)
        {
            _incredible.gameObject.SetActive(false);
            _incredible.rectTransform.localPosition = Vector2.zero;
            _unbelievable.rectTransform.localScale  = Vector2.one;
        }
        if (!LeanTween.isTweening(_unbelievable.gameObject) && _unbelievableTimer.IsCompleted)
        {
            _unbelievable.gameObject.SetActive(false);
            _unbelievable.rectTransform.localPosition = Vector2.zero;
            _unbelievable.rectTransform.localScale    = Vector2.one;
        }
        if (!LeanTween.isTweening(_comboMaster.gameObject) && _combomasterTimer.IsCompleted)
        {
            _comboMaster.gameObject.SetActive(false);
            _comboMaster.rectTransform.localPosition = Vector2.zero;
            _unbelievable.rectTransform.localScale   = Vector2.one;
        }
    }
Esempio n. 7
0
    public IEnumerator BlinkTitle()
    {
        int count = 0;

        while (!RulerScript.Instance.isPlaneFound)
        {
            if (count > instructions.Length - 1)
            {
                count = 0;
            }



            LeanTween.alphaCanvas(canvasGroup, 0, blinkDuration);
            yield return(new WaitWhile(() => LeanTween.isTweening()));

            instructionText.text = instructions[count++];

            LeanTween.alphaCanvas(canvasGroup, 1, blinkDuration);
            yield return(new WaitWhile(() => LeanTween.isTweening()));
        }

        statusPanel.SetActive(false);
        foundPanel.SetActive(true);
    }
Esempio n. 8
0
 public void HideGameOverScreen(bool win)
 {
     if (!LeanTween.isTweening())
     {
         LeanTween.scale(win ? gameoverScreenWin : gameoverScreenLose, Vector3.zero, .5f);
     }
 }
 private void PunchTextMesh(TextMeshProUGUI textToPunch)
 {
     if (!LeanTween.isTweening(textToPunch.gameObject))
     {
         LeanTween.scale(textToPunch.gameObject, new Vector3(1.5f, 1.5f), 0.3f).setEasePunch().setLoopClamp().setLoopCount(1);
     }
 }
Esempio n. 10
0
    public void setFlick(Vector2 v)
    {
        if (ignoredTrigger == true)
        {
            return;
        }
        if (flickFlag == true)
        {
            return;
        }
        if (LeanTween.isTweening(this.gameObject))
        {
            return;
        }
        flickFlag = true;

        if (Mathf.Abs(v.x) >= Mathf.Abs(v.y))
        {
            v.y = 0f;
            v.Normalize();
        }
        else
        {
            v.x = 0.0f;
            v.Normalize();
        }
        flickVector = v;
    }
Esempio n. 11
0
        private void InterpolateCameraZoom(int currentLevel)
        {
            if (LeanTween.isTweening(_cameraZoomId))
            {
                return;
            }

            var bounds = _levelBounds[currentLevel];
            var mid    = (bounds.Item1 + bounds.Item2) / 2f;

            // Interpolate camera zoom between levels
            var yPos             = transform.position.y;
            var delta            = -mid + yPos;
            var closestNextLevel = delta < 0
                                ? (currentLevel <= 0 ? 0 : currentLevel - 1)
                                : (currentLevel >= _levelBounds.Length - 1 ? _levelBounds.Length - 1 : currentLevel + 1);
            var nextBounds = _levelBounds[closestNextLevel];
            var nextMid    = (nextBounds.Item1 + nextBounds.Item2) / 2f;
            var deltaRatio = Mathf.Abs(delta) > Mathf.Abs(nextMid - mid) ? 1f : Mathf.Abs(delta) / Mathf.Abs(nextMid - mid);

            var puzzleScale       = _levels[_selectedLevel].GetComponent <PuzzleScale>();
            var selectedLevelZoom = CameraScript.CameraZoomToFit(puzzleScale.Dimensions, puzzleScale.Margin, _scaleRatio);

            var nextPuzzleScale = _levels[closestNextLevel].GetComponent <PuzzleScale>();
            var nextLevelZoom   = CameraScript.CameraZoomToFit(nextPuzzleScale.Dimensions, nextPuzzleScale.Margin, _scaleRatio);

            Camera.main.orthographicSize = LeanTween.easeInOutSine(selectedLevelZoom, nextLevelZoom, deltaRatio);
        }
Esempio n. 12
0
 public void AnimateReverse()
 {
     if (!LeanTween.isTweening(this.gameObject))
     {
         LeanTween.moveLocal(this.gameObject, startingPosition, animationTime);
     }
 }
Esempio n. 13
0
    public void ScreenShake()
    {
        /**************
        * Camera Shake
        **************/
        if (!LeanTween.isTweening(camx.gameObject))
        {
            float height = Mathf.PerlinNoise(jumpIter, 0f) * 5f;
            height = height * height * 0.2f;

            float   shakeAmt        = height * 0.9f;                    // the degrees to shake the camera
            float   shakePeriodTime = 0.2f;                             // The period of each shake
            float   dropOffTime     = 0.3f;                             // How long it takes the shaking to settle down to nothing
            LTDescr shakeTween      = LeanTween.rotateAroundLocal(camx.gameObject, Vector3.right, shakeAmt, shakePeriodTime)
                                      .setEase(LeanTweenType.easeShake) // this is a special ease that is good for shaking
                                      .setLoopClamp()
                                      .setRepeat(-1);

            // Slow the camera shake down to zero
            LeanTween.value(camx.gameObject, shakeAmt, 0f, dropOffTime).setOnUpdate(
                (float val) =>
            {
                shakeTween.setTo(Vector3.right * val);
            }
                ).setEase(LeanTweenType.easeOutQuad).setOnComplete(
                () =>
            {
                LeanTween.cancel(camx.gameObject);
                camx.transform.rotation = Quaternion.identity;
            });
        }
    }
    public static void ReceiveHealth(GameObject gameObject, Color originalColor, Action onComplete = null)
    {
        if (LeanTween.isTweening(gameObject))
        {
            return;
        }

        LeanTween.color(gameObject, Color.green, 0.25f)
        .setEaseInCubic()
        .setOnComplete(() =>
        {
            LeanTween.color(gameObject, originalColor, 0.25f)
            .setEaseInCubic()
            .setOnComplete(() =>
            {
                LeanTween.color(gameObject, Color.green, 0.25f)
                .setEaseInCubic()
                .setOnComplete(() =>
                {
                    LeanTween.color(gameObject, originalColor, 0.25f)
                    .setEaseInCubic()
                    .setOnComplete(onComplete);
                });
            });
        });
    }
Esempio n. 15
0
        //Show animation
        public void Show()
        {
            if (animationSettings != null)
            {
                //Null pointer check and cancel tween if one already in progress
                if (objectToAnimate == null)
                {
                    objectToAnimate = gameObject;
                }
                else
                {
                    LeanTween.cancel(objectToAnimate);
                }

                CheckForIdealTweenConditions();

                HandleTween(false, animationSettings.inAnimationType, animationSettings.inEaseType, animationSettings.inDelay,
                            animationSettings.inDuration, animationSettings.inLoop, animationSettings.inPingpong, animationSettings.inStartPositionOffset);

                //Turns object to active if object is actually tweening
                if (LeanTween.isTweening(objectToAnimate))
                {
                    objectToAnimate.SetActive(true);
                }
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Stops all active portrait tweens.
        /// </summary>
        public static void StopPortraitTweens()
        {
            // Stop all tweening portraits
            var activeCharacters = Character.ActiveCharacters;

            for (int i = 0; i < activeCharacters.Count; i++)
            {
                var c = activeCharacters[i];
                if (c.State.portraitImage != null)
                {
                    if (LeanTween.isTweening(c.State.portraitImage.gameObject))
                    {
                        LeanTween.cancel(c.State.portraitImage.gameObject, true);
                        PortraitController.SetRectTransform(c.State.portraitImage.rectTransform, c.State.position);
                        if (c.State.dimmed == true)
                        {
                            c.State.portraitImage.color = new Color(0.5f, 0.5f, 0.5f, 1f);
                        }
                        else
                        {
                            c.State.portraitImage.color = Color.white;
                        }
                    }
                }
            }
        }
Esempio n. 17
0
 void TweenSmaller()
 {
     Assert.IsFalse(LeanTween.isTweening(gameObject));
     LeanTween.scale(gameObject, _originalScale, time).setEaseInOutCirc();
     LeanTween.moveLocalZ(gameObject, _originalPos.z, time).setEaseInOutCirc();
     scaledUp = false;
 }
Esempio n. 18
0
    public void ChangeTab(int tabID)
    {
        if (tabID == currentTab)
        {
            return;
        }
        if (!LeanTween.isTweening(decorGameObject) && !LeanTween.isTweening(potteryGameObject))
        {
            ChangeTabIcon(tabID);
            if (currentTab == 1)
            {
                LeanTween.scale(potteryGameObject, Vector3.zero, 0).setEase(tabTransitionTweenType);
            }
            else if (currentTab == 5)
            {
                LeanTween.scale(decorGameObject, Vector3.zero, 0).setEase(tabTransitionTweenType);
            }

            if (tabID == 1)
            {
                LeanTween.scale(potteryGameObject, new Vector3(1, 1, 1), 0).setOnComplete(ChangeCurrentPanel);
            }
            else if (tabID == 5)
            {
                LeanTween.scale(decorGameObject, new Vector3(1, 1, 1), 0).setOnComplete(ChangeCurrentPanel);
            }
        }

        void ChangeCurrentPanel()
        {
            currentTab = tabID;
        }
    }
Esempio n. 19
0
    void Update()
    {
        var pos = cube1.position;

        pos.x          = LeanTween.smoothDamp(cube1.position.x, followTrans.position.x, ref cube1VelocityX, 1.1f);
        cube1.position = pos;

        pos            = cube2.position;
        pos.x          = LeanTween.smoothGravity(cube2.position.x, followTrans.position.x, ref cube2VelocityX, 1.1f);
        cube2.position = pos;

        pos            = cube3.position;
        pos.x          = LeanTween.smoothBounceOut(cube3.position.x, followTrans.position.x, ref cube3VelocityX, 1.1f);
        cube3.position = pos;

        pos            = cube4.position;
        pos.x          = LeanTween.smoothQuint(cube4.position.x, followTrans.position.x, ref cube4VelocityX, 1.1f);
        cube4.position = pos;

        pos            = cube5.position;
        pos.x          = LeanTween.smoothLinear(cube5.position.x, followTrans.position.x, 10f);
        cube5.position = pos;


        // cube6.position = LeanTween.smoothGravity(cube6.position, followTrans.position, ref cube6Velocity, 1.1f);

        if (LeanTween.isTweening(0))
        {
            Debug.Log("Tweening");
        }
    }
Esempio n. 20
0
    /*////////////////////////////////////////////////////////////////////////////////////////////////*/
    /// <summary>
    /// animate close
    /// </summary>
    /*///////////////////////////////////////////////////////////////////////////////////////////////*/
    void CloseDoor()
    {
        if(LeanTween.isTweening(this.gameObject))
            LeanTween.cancel(this.gameObject);

        LeanTween.moveLocal(this.gameObject, Vector3.zero, closeTime).setEase(closeCurve);
    }
Esempio n. 21
0
        void TweenPlanets_Fever()
        {
            if (LeanTween.isTweening(leftPlanets[buttomNum]))
            {
                LeanTween.cancelAll();
                ForcePlanets();
            }

            int j = 0;

            leftPlanets[buttomNum].transform.localPosition  = leftPosition[9];      // 맨밑 행성 맨위로, 사이즈 조절
            rightPlanets[buttomNum].transform.localPosition = rightPosition[9];
            leftPlanets[buttomNum].transform.localScale    *= sizeDown;
            rightPlanets[buttomNum].transform.localScale   *= sizeDown;

            rightPlanets[buttomNum].GetComponent <Planet>().setSprite(3);
            leftPlanets[buttomNum].GetComponent <Planet>().setSprite(3);

            for (int i = buttomNum + 1; i < 10; i++, j++)       // 나머지는 한칸씩 아래로
            {
                LeanTween.moveLocal(leftPlanets[i], leftPosition[j], moveTime);
                LeanTween.moveLocal(rightPlanets[i], rightPosition[j], moveTime);
            }
            for (int i = 0; i < buttomNum; i++, j++)
            {
                LeanTween.moveLocal(leftPlanets[i], leftPosition[j], moveTime);
                LeanTween.moveLocal(rightPlanets[i], rightPosition[j], moveTime);
            }

            buttomNum = ++buttomNum % 10;

            leftPlanets[buttomNum].transform.localScale  *= sizeUp;
            rightPlanets[buttomNum].transform.localScale *= sizeUp;
        }
Esempio n. 22
0
 // Update is called once per frame
 void Update()
 {
     if (Loop && (TweenId < 0 || !LeanTween.isTweening(TweenId)))
     {
         TweenId = LeanTween.value(gameObject, (value) => { transform.localScale = Vector3.one * value; }, StartScale, EndScale, Duration).id;
     }
 }
Esempio n. 23
0
    /*////////////////////////////////////////////////////////////////////////////////////////////////*/
    /// <summary>
    /// animate open
    /// </summary>
    /*///////////////////////////////////////////////////////////////////////////////////////////////*/
    void OpenDoor()
    {
        if(LeanTween.isTweening(this.gameObject))
            LeanTween.cancel(this.gameObject);

        LeanTween.moveLocal(this.gameObject, offsetPosition, openTime).setEase(openCurve);
    }
Esempio n. 24
0
 void OnDisable()
 {
     if (TweenId < 0 || !LeanTween.isTweening(TweenId))
     {
         LeanTween.cancel(TweenId);
     }
 }
Esempio n. 25
0
        protected virtual IEnumerator WaitForInput(Action onInput)
        {
            while (!wasPointerClicked)
            {
                yield return(null);
            }
            wasPointerClicked = false;

            if (onInput != null)
            {
                // Stop all tweening portraits
                foreach (Character c in Character.activeCharacters)
                {
                    if (c.state.portraitImage != null)
                    {
                        if (LeanTween.isTweening(c.state.portraitObj))
                        {
                            LeanTween.cancel(c.state.portraitObj, true);
                            c.state.portraitImage.material.SetFloat("_Fade", 1);
                            Portrait.SetRectTransform(c.state.portraitImage.rectTransform, c.state.position);
                            if (c.state.dimmed == true)
                            {
                                c.state.portraitImage.material.SetColor("_Color", new Color(0.5f, 0.5f, 0.5f, 1f));
                            }
                            else
                            {
                                c.state.portraitImage.material.SetColor("_Color", new Color(1f, 1f, 1f, 1f));
                            }
                        }
                    }
                }
                onInput();
            }
        }
Esempio n. 26
0
    void SwordAttack(int index)
    {
        if (index == playerIndex)
        {
            if (currentPickup == PickupType.Dagger && !LeanTween.isTweening(swordAttackTweenID))
            {
                //print ("Attack");

                swordAttackTweenID = LeanTween.moveLocal(daggerPickupMode, new Vector3(0, 0, attackLength), 0.1f)
                                     .setOnComplete(() => {
                    swordAttackTweenID = LeanTween.moveLocal(daggerPickupMode, Vector3.zero, 0.1f).id;
                }).id;

                var scale = stretchObj.transform.localScale;

                LeanTween.scale(stretchObj, new Vector3(scale.x, scale.y * swordAttackStretchAmount, scale.z), 0.1f).setOnComplete(() =>
                {
                    LeanTween.scale(stretchObj, scale, 0.1f);
                });

                swordAttacking = true;

                attackSphere.gameObject.SetActive(true);

                Manager.Instance.audioManager.Play(AudioType.DaggerSwish);

                LeanTween.delayedCall(0.1f, () => {
                    swordAttacking = false;
                    attackSphere.gameObject.SetActive(false);
                });
            }
        }
    }
Esempio n. 27
0
    public void NextCharacter()
    {
        if (characterCurrent != characterCount - 1 && LeanTween.isTweening(heroesGO) == false)
        {
            characterCurrent += 1;

            character2Name.text     = charactersLibrary[characterCurrent].characterName;
            character2Sprite.sprite = charactersLibrary[characterCurrent].characterSprite;

            LeanTween.moveLocalY(heroesGO, +498f, 0.5f).setEaseInCubic().setOnComplete(() =>
            {
                heroesGO.transform.localPosition = new Vector3(0f, 0f, transform.position.z);

                character1Name.text         = charactersLibrary[characterCurrent].characterName;
                character1Sprite.sprite     = charactersLibrary[characterCurrent].characterSprite;
                characterBiography.text     = charactersLibrary[characterCurrent].characterBiography;
                characterAbilityIcon.sprite = charactersLibrary[characterCurrent].characterAbilityIcon;

                if (characterCurrent == characterCount - 1)
                {
                    characterCurrent = -1;
                    //buttonNextCharacter.interactable = false;
                }
            });
        }
        else
        {
            //buttonNextCharacter.interactable = false;
            //characterCurrent = 0;
        }

        avatarSprite = character1Sprite.sprite;
    }
Esempio n. 28
0
 private void OnDestroy()
 {
     if (LeanTween.isTweening(_moveAnimationId))
     {
         LeanTween.cancel(_moveAnimationId, true);
     }
 }
Esempio n. 29
0
    public void Select(bool anim = true)
    {
        if (click != null)
        {
            LeanAudio.play(click, 0.2f);
        }
        shop.DeselectAll();
        isActive = true;
        if (scaleTween != null)
        {
            Debug.Log("Tweening zoom 1" + LeanTween.isTweening(scaleTween.id) + " " + scaleTween.id);
        }
        if (!profile.isPurchased && profile.price > shop.bank.balance)
        {
            shop.bank.Shake();
        }
        else
        {
            if (anim)
            {
                skeleton.AnimationState.SetAnimation(0, "tap", false);
                skeleton.AnimationState.AddAnimation(0, "idle", true, 0);
            }
        }
        if (anim)
        {
            scaleTween = LeanTween.scale(gameObject, Vector3.one * 0.8f, 0.1f).setEase(LeanTweenType.easeOutCubic).setOnComplete(() => {
                scaleTween = LeanTween.scale(gameObject, Vector3.one, 0.15f).setEase(LeanTweenType.easeInOutCubic);
            });
        }

        UpdateStatus();
    }
Esempio n. 30
0
    public void OnClick(object sender, ClickedEventArgs e)
    {
        if (LeanTween.isTweening(gameObject))
        {
            Debug.Log("in tweening");
            return;
        }

        if (!ToolsetEnable)
        {
            Debug.Log("Toolset Enable");
            return;
        }

        Vector2 currTouchpadAxis = GetTouchpadAxis();

        //Debug.Log ("x: " + currTouchpadAxis.x + ", y: " + currTouchpadAxis.y);

        if (IfInBetween(currTouchpadAxis.y) && IfInBetween(currTouchpadAxis.x))
        {
            if (OnTouchpadClickCenter != null)
            {
                OnTouchpadClickCenter(true);
            }
            //Debug.Log ("pad center");
        }
        else if (currTouchpadAxis.y > 0.5f && IfMightInBetween(currTouchpadAxis.x))
        {
            if (OnTouchpadClick != null)
            {
                OnTouchpadClick(true);
            }
            touchArrows [0].material.color = Color.red;
            //Debug.Log ("pad up");
        }
        else if (currTouchpadAxis.y < -0.5f && IfMightInBetween(currTouchpadAxis.x))
        {
            if (OnTouchpadClick != null)
            {
                OnTouchpadClick(false);
            }
            touchArrows [1].material.color = Color.red;
            //Debug.Log ("pad down");
        }
        else if (currTouchpadAxis.x > 0.5f && IfMightInBetween(currTouchpadAxis.y))
        {
            SnapToAngleAction(-eachR, 0.3f);
            touchArrows [3].material.color = Color.red;
            //Debug.Log ("pad right");
        }
        else if (currTouchpadAxis.x < -0.5f && IfMightInBetween(currTouchpadAxis.y))
        {
            SnapToAngleAction(eachR, 0.3f);
            touchArrows [2].material.color = Color.red;
            //Debug.Log ("pad left");
        }

        DeviceVibrate();
    }