scaleX() public static method

public static scaleX ( GameObject gameObject, float to, float time ) : LTDescr,
gameObject GameObject
to float
time float
return LTDescr,
Exemplo n.º 1
0
    private void DealÑards()
    {
        color = Random.Range(0, 4);

        BetweenCalc();

        lastx = 0;
        int i = 0;

        foreach (ListedCard card in cards)
        {
            LeanTween.scaleX(card.gameObject, 0, 0.15f);

            LeanTween.moveLocal(card.gameObject, new Vector3(lastx - sdvig, 0), 1f)
            .setEaseOutCirc().setDelay(i * 0.3f);
            LeanTween.moveLocal(cardBacks[i], new Vector3(lastx - sdvig, 0), 1f)
            .setEaseOutCirc().setDelay(i * 0.3f);

            LeanTween.scaleX(card.gameObject, 1, 0.15f).setDelay(i * 0.3f + 0.3f);
            LeanTween.scaleX(cardBacks[i], 0, 0.15f).setDelay(i * 0.3f + 0.15f);
            if (card.script.color == color)
            {
                lastx        += betweenBig;
                card.im.color = Color.white;
            }
            else
            {
                lastx        += betweenSmall;
                card.im.color = Color.gray;
            }
            i++;
            card.btn.enabled = false;
        }
        StartCoroutine("DelayBackDestroy");
    }
        public IEnumerator IFlip(bool turnFaceUp, float flipSpeed = 0.25f)
        {
            var isAnimating = true;

            LeanTween.scaleX(gameObject, 0, flipSpeed)
            .setEaseInBack()
            .setOnStart(() =>
            {
                SetInteractability(false);
            })
            .setOnComplete(() =>
            {
                backgroundImage.sprite = turnFaceUp ? Data.FrontSprite : Data.BackSprite;

                LeanTween.scaleX(gameObject, 1, flipSpeed)
                .setOnComplete(() =>
                {
                    IsTurned = turnFaceUp;
                    SetInteractability(turnFaceUp);

                    isAnimating = false;
                })
                .setEaseOutCubic();
            });

            yield return(new WaitWhile(() => isAnimating));
        }
Exemplo n.º 3
0
 public void OpenQuestWindow()
 {
     if (quest.isFinished)
     {
         return;
     }
     LeanTween.scaleX(questWindow, 1f, 0.5f);
     titleText.text       = quest.title;
     descriptionText.text = quest.description;
     goalText.text        = $"{quest.goal.description} ({quest.goal.currentAmount}/{quest.goal.requiredAmount})";
     rewardText.text      = $"Experiência: {quest.experienceReward}.\nItens: Set de armadura de escamas média.";
     if (quest.isActive)
     {
         if (quest.goal.isReached)
         {
             acceptButtonText.text = "Concluir";
             AcceptButton.onClick.AddListener(() => GetRewards());
         }
         else
         {
             acceptButtonText.text = "Continuar";
             AcceptButton.onClick.AddListener(() => CloseWindow());
         }
     }
     else
     {
         acceptButtonText.text = "Aceitar";
         AcceptButton.onClick.AddListener(() => AcceptQuest());
     }
 }
Exemplo n.º 4
0
    public override void ExecuteViewAction(GameAction action, UnityAction <ActionViewer> onCompleteCallback)
    {
        var drawCardAction = (DrawCardAction)action;

        var cardView = SpawnCard(drawCardAction.Card);

        LeanTween.move(cardView.gameObject, transform.position, moveTime)
        .setOnComplete(() =>
        {
            cardView.transform.SetParent(transform);
            cardView.transform.SetAsLastSibling();

            FanCards();

            if (drawCardAction.ShouldReveal)
            {
                LeanTween.scaleX(cardView.gameObject, 0, scaleTime)
                .setOnComplete(() =>
                {
                    cardView.SetRevealed(true);
                    LeanTween.scaleX(cardView.gameObject, 1, scaleTime)
                    .setOnComplete(() => onCompleteCallback.Invoke(this));
                });
            }
            else
            {
                onCompleteCallback.Invoke(this);
            }
        });
    }
Exemplo n.º 5
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            isMoving = true;

            animator.SetTrigger("moving");

            transform.localScale = new Vector3(.2f, .2f, 1);
            Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z   = 0f;
            transform.up = mousePos - transform.position;


            LeanTween.move(this.gameObject, mousePos, jumpDuration).setEase(jumpCurve).setOnComplete(attack);
            LeanTween.scaleX(this.gameObject, transform.localScale.x / stretchAndSquash, jumpDuration).setEase(jumpStretching).setOnComplete(isNotMoving);
            LeanTween.scaleY(this.gameObject, transform.localScale.x * (stretchAndSquash * 0.75f), jumpDuration).setEase(jumpStretching);
        }



        Debug.DrawLine(transform.position, transform.position + (transform.up * attackRange), Color.red, 0f);

        //transform.position += new Vector3(-1, 1, 0)*wind;
    }
Exemplo n.º 6
0
    private IEnumerator ExpandDecos()
    {
        LeanTween.alphaText(header.rectTransform, 1, 0.2f).setIgnoreTimeScale(true).setOnComplete(() =>
                                                                                                  LeanTween.alphaText(gameOverText.rectTransform, 1, 0.1f).setIgnoreTimeScale(true).setOnComplete(() =>
                                                                                                                                                                                                  LeanTween.alphaText(winInformation.rectTransform, 1, 0.2f).setIgnoreTimeScale(true)));

        yield return(new WaitForSecondsRealtime(0.6f));

        foreach (var item in decos)
        {
            LeanTween.scaleX(item.gameObject, 1, 2).setIgnoreTimeScale(true);
        }

        yield return(new WaitForSecondsRealtime(0.1f));

        foreach (var item in buttons)
        {
            item.gameObject.SetActive(true);
            yield return(new WaitForSecondsRealtime(0.7f));
        }

        foreach (var item in buttons)
        {
            item.Enable(true);
        }
    }
Exemplo n.º 7
0
    /// <summary>
    /// Performs the given tweeing event on this GameObject
    /// </summary>
    public void PerformEvent(TweenEvent tweenEvent, float duration)
    {
        // If the tween modifies position
        if ((tweenEvent.type & TweenType.Position) == TweenType.Position)
        {
            // Perform a tween on the GameObject's localPosition, lasting 'duration' seconds
            LeanTween.moveLocal(gameObject, tweenEvent.targetPosition, duration).setEase(tweenEvent.positionEasingType);
        }

        // If the tween modifies scale
        if ((tweenEvent.type & TweenType.Scale) == TweenType.Scale)
        {
            // Perform a tween on the GameObject's scale, lasting 'duration' seconds
            LeanTween.scaleX(gameObject, tweenEvent.targetScale.x, duration).setEase(tweenEvent.scaleEasingType);
            LeanTween.scaleY(gameObject, tweenEvent.targetScale.y, duration).setEase(tweenEvent.scaleEasingType);
            LeanTween.scaleZ(gameObject, tweenEvent.targetScale.z, duration).setEase(tweenEvent.scaleEasingType);
        }

        // If the tween modifies rotation
        if ((tweenEvent.type & TweenType.Rotation) == TweenType.Rotation)
        {
            // Perform a tween on the GameObject's scale, lasting 'duration' seconds
            LeanTween.rotateZ(gameObject, tweenEvent.targetAngle, duration).setEase(tweenEvent.rotationEasingType);
        }

        //Debug.Log ("PERFORM THE TWEEN: " + tweenEvent.ToString ());
        //Debug.Log ("Duration: " + duration + " seconds");
    }
Exemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        // Change HP text when value is changed
        hp.SubscribeToText(hpText);

        // Add animation ( we use LeanTween for this because it's a simple library that just works )
        hp.Subscribe(_ => AnimateObj(hpText.gameObject));

        // HP Bar
        hp.Subscribe(currentHP => {
            float normalizedHP = (currentHP / 100f);
            LeanTween.scaleX(hpBar, normalizedHP, 0.2f)
            .setEase(LeanTweenType.easeOutCirc);
        });

        // HP Delta
        hp.Throttle(TimeSpan.FromMilliseconds(500)).Subscribe(delayedHP => {
            float normalizedHP = (delayedHP / 100f);
            LeanTween.scaleX(hpDelta, normalizedHP, 0.2f)
            .setEase(LeanTweenType.easeInQuad);
        });

        // Button actions ------------------------
        damageButton.onClick.AddListener(DamageHP);
        resetButton.onClick.AddListener(ResetHP);
    }
    public IEnumerator Show(ICardInfo _cardInfo, AudioClip _sfx = null)
    {
        if (currentState == State.Show)
        {
            yield break;
        }
        currentState = State.Show;
        float _saveX      = transform.localScale.x;
        bool  _isFinished = false;

        if (_sfx != null)
        {
            MyAudioManager.instance.PlaySfx(_sfx);
        }
        LeanTween.scaleX(gameObject, 0f, 0.1f).setOnComplete(() => {
            _isFinished = true;
        });
        yield return(new WaitUntil(() => _isFinished));

        ShowNow(_cardInfo);

        _isFinished = false;
        LeanTween.scaleX(gameObject, _saveX, 0.1f).setOnComplete(() => {
            _isFinished = true;
        });
        yield return(new WaitUntil(() => _isFinished));
    }
Exemplo n.º 10
0
        public void StartGlowing()
        {
            LeanTween.scaleX(gameObject, scaleStrength.x, scaleDuration.x).setLoopPingPong(-1).setIgnoreTimeScale(true);
            LeanTween.scaleY(gameObject, scaleStrength.y, scaleDuration.y).setLoopPingPong(-1).setIgnoreTimeScale(true);

            Debug.Log("Start glowing");
        }
    public virtual IEnumerator Hide(AudioClip _sfx = null)
    {
        if (currentState == State.Hide)
        {
            yield break;
        }
        currentState = State.Hide;
        bool _isFinished = false;

        if (_sfx != null)
        {
            MyAudioManager.instance.PlaySfx(_sfx);
        }
        LeanTween.scaleX(gameObject, 0f, 0.1f).setOnComplete(() => {
            _isFinished = true;
        });
        yield return(new WaitUntil(() => _isFinished));

        imgCardCover.gameObject.SetActive(true);
        txtCardValue.gameObject.SetActive(false);
        imgSmallCardKind.gameObject.SetActive(false);
        imgBigCardKind.gameObject.SetActive(false);

        imgSmallCardKind.sprite = null;
        imgBigCardKind.sprite   = null;
        txtCardValue.text       = string.Empty;
        txtCardValue.color      = Color.white;

        _isFinished = false;
        LeanTween.scaleX(gameObject, 1f, 0.1f).setOnComplete(() => {
            _isFinished = true;
        });
        yield return(new WaitUntil(() => _isFinished));
    }
Exemplo n.º 12
0
 public void shake()
 {
     Debug.Log(this.name + baseRotation.z);
     if (state == State.Closed)          //open shake
     {
         if (!LeanTween.isTweening(gameObject))
         {
             //LeanTween.moveY (gameObject, 0.03f, 0.3f).setEase (LeanTweenType.easeShake);
             //LeanTween.rotateZ (gameObject, (baseRotation.z - 3.0f), 0.2f).setEase (LeanTweenType.easeShake);
             LeanTween.scaleX(gameObject, (baseScale.x * 0.9f), 0.2f).setEase(LeanTweenType.easeOutCubic);
             LeanTween.scaleY(gameObject, (baseScale.y * 1.1f), 0.2f).setEase(LeanTweenType.easeOutCubic);
             LeanTween.scaleX(gameObject, (baseScale.x), 0.2f).setEase(LeanTweenType.easeInOutCubic).setDelay(0.2f);
             LeanTween.scaleY(gameObject, (baseScale.y), 0.2f).setEase(LeanTweenType.easeInOutCubic).setDelay(0.2f);
         }
     }
     else if (state == State.Peek)          //If hide is empty
     {
         if (!LeanTween.isTweening(gameObject))
         {
             LeanTween.moveX(gameObject, 0.1f, 0.2f).setEase(LeanTweenType.easeShake);
         }
     }
     else if (state == State.Open)          //If hide reveals a bug
     {
         if (!LeanTween.isTweening(gameObject))
         {
             LeanTween.moveY(gameObject, 0.07f, 0.3f).setEase(LeanTweenType.easeShake);
             LeanTween.rotateZ(gameObject, baseRotation.z + 6.0f, 0.25f).setEase(LeanTweenType.easeShake);
         }
     }
 }
Exemplo n.º 13
0
 void OnMouseDown()
 {
     ToggleTouch(this, true);
     LeanTween.scaleX(gameObject, 0f, 0.05f).setOnComplete(() => {
         LeanTween.scaleX(gameObject, 0.3f, 0.08f);
     });
 }
    private IEnumerator PlaceCardOnBoard(float duration)
    {
        SpawnBoardCardCommand spawnBoardCardCommand = new SpawnBoardCardCommand(_boardCardSpawner, _card);
        BoardCard             spawnedBoardCard;

        if (spawnBoardCardCommand.CanExecute())
        {
            Vector2 newPos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
            Vector2 oldPos = new Vector2(_playerManager.CardToPlaceGO.transform.position.x,
                                         _playerManager.CardToPlaceGO.transform.position.x);
            LeanTween.move(_playerManager.CardToPlaceGO, newPos, duration);
            LeanTween.scaleX(_playerManager.CardToPlaceGO, 0.75f, duration);
            LeanTween.scaleY(_playerManager.CardToPlaceGO, 0.75f, duration);
            AudioHelper.PlayClip2D(_cardPlaceAudio, 1f);
            yield return(new WaitForSeconds(duration));

            spawnedBoardCard = _commandInvoker.ExecuteReturnBoardCard(spawnBoardCardCommand, _card);
            if (spawnedBoardCard != null)
            {
                _card.Play();
                _playerManager.DiscardPlayedCard();
                Destroy(_playerManager.CardToPlaceGO);
                StateMachine.ChangeState <DateTurnCardGameState>();
            }
            else
            {
                LeanTween.move(_playerManager.CardToPlaceGO, oldPos, duration);
                LeanTween.scaleX(_playerManager.CardToPlaceGO, 1f, duration);
                LeanTween.scaleY(_playerManager.CardToPlaceGO, 1f, duration);
            }
        }
    }
Exemplo n.º 15
0
        public void Show(string forceText = "")
        {
            if (!isShown)
            {
                LeanTween.cancel(container);

                container.gameObject.SetActive(true);
                LeanTween.scaleX(container.gameObject, baseScale.x * 1f, .15f)
                .setEaseOutQuad();

                LeanTween.scaleY(container.gameObject, baseScale.y * 1f, .3f)
                .setEaseOutBack();
                // .setOnComplete(() => container.gameObject.SetActive(true));

                if (string.IsNullOrEmpty(forceText))
                {
                    //text.text = texto;
                    textTMP.text = texto;
                }
                else
                {
                    //text.text = forceText;
                    textTMP.text = forceText;
                }

                isShown = true;
            }
        }
Exemplo n.º 16
0
 private void AnimationCard(Card[] Cards, int value, bool isDraw = false)
 {
     //Debug.Log(value);
     LeanTween.scaleX(Cards[value].gameObject, 0, 0.05f).setOnComplete(() =>
                                                                       FlipCard(Cards, value, isDraw)
                                                                       );
 }
 public void OnClick()
 {
     if (!zoomed)
     {
         zoomed         = true;
         theImage       = gameObject;
         originalParent = transform.parent.gameObject;
         prevPos        = transform.position;
         theZoomedImage = GameObject.Instantiate(theImage);
         theZoomedImage.transform.position = prevPos;
         theZoomedImage.GetComponent <Image>().preserveAspect    = true;
         theZoomedImage.GetComponent <RectTransform>().sizeDelta = new Vector2(130, 130);
         theZoomedImage.transform.parent = GameObject.Find("Image container").transform;
         LeanTween.move(theZoomedImage, new Vector3(Screen.width * 0.5f, Screen.height * 0.5f, 0), 0.2f);
         float worldScreenHeight = Camera.main.orthographicSize * 2.0f;
         float worldScreenWidth  = (worldScreenHeight / Screen.height) * Screen.width;
         float imageWidth        = GetComponent <RectTransform>().rect.width;
         LeanTween.scaleX(theZoomedImage, Screen.width / imageWidth, 0.2f);
         LeanTween.scaleY(theZoomedImage, Screen.width / imageWidth, 0.2f);
         GameObject.Find("Zoom background").GetComponent <Image>().raycastTarget = true;
         RectTransform zoomBg = GameObject.Find("Zoom background").GetComponent <RectTransform>();
         LeanTween.alpha(zoomBg, 1f, 0.2f);
         GameObject.Find("Back from zoom").GetComponent <Image>().raycastTarget = true;
         RectTransform backFromZoomButton = GameObject.Find("Back from zoom").GetComponent <RectTransform>();
         LeanTween.alpha(backFromZoomButton, 1f, 0.2f);
     }
 }
Exemplo n.º 18
0
    private void FlipSequenceCloseHelper()
    {
        tweeningContentParent.SetActive(false);

        tweeningCoverParent.transform.localScale = new Vector3(0f, 1f, 1f);
        tweeningCoverParent.SetActive(true);
        LeanTween.scaleX(tweeningCoverParent, 1f, activeTweenTime / 2f).setOnComplete(FlipSequenceCloseFinished);
    }
Exemplo n.º 19
0
 public void AnimateBar()
 {
     if (!canFire)
     {
         LeanTween.scaleX(bar, 1, time).setOnComplete(FireEnable);
         //watched this tutorial for the bar timer: https://www.youtube.com/watch?v=z7bR_xYcopM
     }
 }
 void AnimateThenDestory(GameObject eventObject)
 {
     LeanTween
     .scaleX(eventObject, 1.1f, 0.1f);
     LeanTween
     .scaleY(eventObject, 1.1f, 0.1f)
     .setOnComplete(() => destoryQueue.Add(eventObject));
 }
Exemplo n.º 21
0
    private void PlayFlipSquenceOpen()
    {
        AudioManager.Instance.PlayClip("memoryCard1");

        // Zoom in on the whole object
        LeanTween.scale(gameObject, new Vector3(activeTweenScale, activeTweenScale, 1), activeTweenTime);
        LeanTween.scaleX(tweeningCoverParent, 0f, activeTweenTime / 2f).setOnComplete(FlipSequenceOpenHelper);
    }
Exemplo n.º 22
0
 public void ScaleX()
 {
     if (startPositionOffset)
     {
         objectToAnimate.GetComponent <Transform>().localScale = from;
     }
     _tweenObject = LeanTween.scaleX(objectToAnimate, to.x, duration);
 }
Exemplo n.º 23
0
 void TweenBigger()
 {
     Assert.IsFalse(LeanTween.isTweening(gameObject));
     LeanTween.scaleX(gameObject, _originalScale.x + scale * scaleAmount.x, time).setEaseInOutCirc();
     LeanTween.scaleZ(gameObject, _originalScale.z + scale * scaleAmount.z, time).setEaseInOutCirc();
     LeanTween.scaleY(gameObject, _originalScale.y + scale * scaleAmount.y, time).setEaseInOutCirc().setDelay(time * .25f);
     LeanTween.moveLocalZ(gameObject, _originalPos.z + move * (invertZ ? -1 : 1) * moveZ, time).setEaseInOutCirc();
     scaledUp = true;
 }
Exemplo n.º 24
0
 /// <summary>
 /// Flip this card.
 /// </summary>
 public void Flip()
 {
     if (fliped == false)
     {
         fliped            = true;
         this.image.sprite = this.face;
         LeanTween.scaleX(this.gameObject, 1, 0.2f);
     }
 }
Exemplo n.º 25
0
        private void OnGoogleLogin()
        {
            LeanTween.scale(Leaderboard, Vector3.one, 1f);
            LeanTween.scale(Achievements, Vector3.one, 1f);

            ProfilePanel.SetActive(true);
            PlayerName.text = GooglePlayManager.Instance.playerData.PlayerName;
            LeanTween.scaleX(PlayerName.transform.parent.gameObject, 1, .8f);
        }
Exemplo n.º 26
0
    public LTDescr ReleaseHoriz()
    {
        if (LeanTween.isTweening(target))
        {
            LeanTween.cancel(target);
        }

        return(LeanTween.scaleX(target, initialSize.x, animTime));
    }
Exemplo n.º 27
0
    public LTDescr HorizSquash()
    {
        if (LeanTween.isTweening(target))
        {
            LeanTween.cancel(target);
        }

        return(LeanTween.scaleX(target, squashSize.x, animTime));
    }
Exemplo n.º 28
0
        private void OnTurnOverComplete()
        {
            frameImage.SetSprite(_frameFrontSprite);

            LeanTween.scaleX(gameObject, 1, 0.15f);
            CommonEquipmentIcon icon = CommonEquipmentIcon.Create(frameImage.transform);

            icon.SetEquipmentInfo(_equipmentInfo);
        }
Exemplo n.º 29
0
 private void UpdateFiberBar(System.Action callback)
 {
     LeanTween.scaleX(gauageBar.gameObject, fiberCount * 0.2f, 0.1f).setOnComplete(() => {
         if (callback != null)
         {
             callback();
         }
     });
 }
Exemplo n.º 30
0
    IEnumerator Win()
    {
        LeanTween.scaleX(winPanel, 1, 0.2f);
        GetComponent <AudioSource>().Play();
        GetComponent <Animator>().SetTrigger("Shake");
        yield return(new WaitForSeconds(2f));

        LevelLoader.instance.StartCoroutine(LevelLoader.instance.LoadLevel(true));
    }