Example #1
0
    public void Show()
    {
        LeanTween.alphaCanvas(canvasGroup, 0, 0);
        LeanTween.size(rt, startSize, 0);
        LeanTween.scale(rt, startScale, 0);
        LeanTween.alphaCanvas(placeholder, 0, 0);
        LeanTween.alphaCanvas(info, 0, 0);

        LTSeq sequence = LeanTween.sequence();

        sequence
        .append(() =>
        {
            LeanTween.scale(rt, Vector3.one, duration).setEase(easeIn);
            LeanTween.alphaCanvas(canvasGroup, 1, duration).setEase(easeIn);
        })
        .append(1f)
        .append(() => LeanTween.size(rt, targetSize, duration).setEase(easeIn))
        .append(duration / 2)
        .append(() => LeanTween.alphaCanvas(placeholder, 1, duration).setEase(easeIn))
        .append(1f)
        .append(() => LeanTween.alphaCanvas(placeholder, 0, duration).setEase(easeIn))
        .append(duration)
        .append(() => LeanTween.alphaCanvas(info, 1, duration).setEase(easeIn));
    }
Example #2
0
    public void OnNextPage()
    {
        ++_pageIndex;
        if (_pageIndex >= _pages.Length)
        {
            StateManager.instance.OpenState(GameConstants.STATENAME_LOBBY);

            return;
        }

        LTSeq sequence = LeanTween.sequence();

        CanvasGroup prevPage = _page;

        if (prevPage != null)
        {
            prevPage.LeanCancel();

            sequence.append(prevPage.LeanAlpha(0.0f, _pageOpenTime * 0.5f));
            sequence.append(() => _page.gameObject.SetActive(false));
        }

        _page       = _pages[_pageIndex];
        _page.alpha = 0.0f;

        sequence.append(() => _page.gameObject.SetActive(true));
        sequence.append(_page.LeanAlpha(1.0f, _pageOpenTime * 0.5f));
        sequence.append(() => {
            Animator animator = _page.GetComponent <Animator>();
            if (animator != null)
            {
                animator.SetTrigger("Play");
            }
        });
    }
Example #3
0
 public void init(uint id, uint global_counter)
 {
     this.reset();
     this._id     = id;
     this.counter = global_counter;
     this.current = this;
 }
Example #4
0
 public void init(uint id, uint global_counter)
 {
     reset();
     _id     = id;
     counter = global_counter;
     current = this;
 }
Example #5
0
    public void MoveAlong(List <Hex> path, int maxSteps = int.MaxValue,
                          Action callback = null, string stepSound = "MechStep")
    {
        int step = 0;

        maxSteps = Math.Min(maxSteps, path.Count);
        LTSeq stepSequence = LeanTween.sequence();
        Hex   pos          = Position;

        while (step < maxSteps)
        {
            pos = path[step];
            if (stepSound != "")
            {
                stepSequence.append(() => { FXHelper.PlaySound(stepSound); });
            }
            stepSequence.append(LeanTween.moveLocal(gameObject, Grid.GetWorldPosition(pos), 0.25f).setEaseInOutQuart());
            step++;
        }
        Position = pos;

        if (callback != null)
        {
            stepSequence.append(callback);
        }
    }
Example #6
0
    void ShowHUD(Vector3 position, string message, Action onComplete = null)
    {
        position = _cachedMainCamera.WorldToScreenPoint(position);

        Vector3 begin = position + _addedScoreBeginOffset;
        Vector3 end   = position + _addedScoreEndOffset;

        _addedScoreText.text = message;

        float appearTime    = _addedScoreAppearTime * HUD_APPEAR_RATIO;
        float disappearTime = _addedScoreAppearTime * (1.0f - HUD_APPEAR_RATIO);

        _addedScoreText.LeanCancel();

        LTSeq sequence = LeanTween.sequence();

        sequence.append(() => _addedScoreText.LeanAlpha(0.0f, 1.0f, appearTime));
        sequence.append(_addedScoreText.LeanScale(Vector3.zero, Vector3.one, appearTime).setEaseOutBack());
        sequence.append(HUD_DISAPPEAR_DELAY);
        sequence.append(() => _addedScoreText.LeanAlpha(0.0f, disappearTime));
        sequence.append(_addedScoreText.LeanMove(begin, end, disappearTime));

        sequence.append(() => {
            if (onComplete != null)
            {
                onComplete();
            }
        });
    }
Example #7
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         sequence.reset();
         sequence = null;
     }
 }
Example #8
0
    public void ShowAndHide(Action callback = null)
    {
        LTSeq sequence = LeanTween.sequence();

        sequence
        .append(() => Show())
        .append(delayBeforeHide)
        .append(() => Hide(callback));
    }
Example #9
0
    public CommandLeanTween(LTDescr leanTween)
    {
        m_LeanTween = leanTween;
        m_LeanTween.pause();

        m_Seq = LeanTween.sequence();
        m_Seq
        .append(m_LeanTween)
        .append(() => m_CommandValidator.iSucceeded(this));
    }
Example #10
0
    private float addPreviousDelays()
    {
        LTSeq lTSeq = this.current.previous;

        if (lTSeq == null || lTSeq.tween == null)
        {
            return(this.current.totalDelay);
        }
        return(this.current.totalDelay + lTSeq.tween.time);
    }
Example #11
0
    private float addPreviousDelays()
    {
        LTSeq lTSeq = current.previous;

        if (lTSeq != null && lTSeq.tween != null)
        {
            return(current.totalDelay + lTSeq.tween.time);
        }
        return(current.totalDelay);
    }
Example #12
0
    private float addPreviousDelays()
    {
        LTSeq prev = this.current.previous;

        if (prev != null && prev.tween != null)
        {
            return(this.current.totalDelay + prev.tween.time);
        }
        return(this.current.totalDelay);
    }
Example #13
0
    private LTSeq addOn()
    {
        LTSeq lastCurrent = this.current;

        this.current            = new LTSeq();
        this.current.previous   = lastCurrent;
        this.current.totalDelay = lastCurrent.totalDelay;
        this.current.count      = lastCurrent.count + 1;
        return(current);
    }
Example #14
0
    public void Emphasize()
    {
        float halfTime = _missionTextScalingTime * 0.5f;

        _missionText.LeanCancel();

        LTSeq sequence = LeanTween.sequence();

        sequence.append(_missionText.LeanScale(_missionTextScale, halfTime).setEaseOutBack());
        sequence.append(_missionText.LeanScale(Vector3.one, halfTime).setEaseInBack());
    }
Example #15
0
 public void Show()
 {
     if (!LeanTween.isTweening(createdWindow))
     {
         seq = LeanTween.sequence();
         seq
         .insert(LeanTween.moveLocal(createdWindow, outPosition, 0))
         .insert(LeanTween.moveLocal(createdWindow, targetPosition, duration).setEase(easeType))
         .append(() => _Hide(delay));
     }
 }
    private float addPreviousDelays()
    {
//		Debug.Log("delay:"+delay+" count:"+this.current.count+" this.current.totalDelay:"+this.current.totalDelay);

        LTSeq prev = this.current.previous;

        if (prev != null && prev.tween != null)
        {
            return(this.current.totalDelay + prev.tween.time);
        }
        return(this.current.totalDelay);
    }
Example #17
0
    private LTSeq addOn()
    {
        current.toggle = true;
        LTSeq lTSeq = current;

        current            = LeanTween.sequence(initSequence: false);
        current.previous   = lTSeq;
        lTSeq.toggle       = false;
        current.totalDelay = lTSeq.totalDelay;
        current.debugIter  = lTSeq.debugIter + 1;
        return(current);
    }
    private LTSeq addOn()
    {
        this.current.toggle = true;
        LTSeq lastCurrent = this.current;

        this.current            = LeanTween.sequence(false);
        this.current.previous   = lastCurrent;
        lastCurrent.toggle      = false;
        this.current.totalDelay = lastCurrent.totalDelay;
        this.current.debugIter  = lastCurrent.debugIter + 1;
        return(current);
    }
Example #19
0
    private LTSeq addOn()
    {
        this.current.toggle = true;
        LTSeq lastCurrent = this.current;

        this.current = LeanTween.sequence(true);
        // //Debug.Log("this.current:" + this.current.id + " lastCurrent:" + lastCurrent.id);
        this.current.previous   = lastCurrent;
        lastCurrent.toggle      = false;
        this.current.totalDelay = lastCurrent.totalDelay;
        this.current.debugIter  = lastCurrent.debugIter + 1;
        return(current);
    }
Example #20
0
    private void Shake(UnityAction callBack = null)
    {
        Vector3 pos      = _myTF.position;
        Vector3 shakePos = new Vector3(0.1f, 0, 0);
        LTSeq   tweenSeq = LeanTween.sequence();

        tweenSeq.append(LeanTween.move(myGO, pos + shakePos, 0.1f).setEase(LeanTweenType.easeShake));
        tweenSeq.append(LeanTween.move(myGO, pos, 0.1f).setEase(LeanTweenType.easeShake));
        tweenSeq.append(() =>
        {
            callBack?.Invoke();
        });
    }
        void Start()
        {
            RectTransform albumTransform = albumIcon.GetComponent <RectTransform>();
            Vector2       startSize      = albumTransform.sizeDelta;
            Vector2       targetSize     = startSize + new Vector2(5, 5);

            LTSeq seq = LeanTween.sequence();

            seq
            .append(LeanTween.size(albumTransform, targetSize, 2))
            .append(LeanTween.size(albumTransform, startSize, 2))
            .append(LeanTween.size(albumTransform, targetSize, 2))
            .append(LeanTween.size(albumTransform, startSize, 2));
        }
Example #22
0
    public LTDescr LoadScene(string sceneName)
    {
        LTSeq seq = LeanTween.sequence();

        if (string.IsNullOrEmpty(loadedScene) == false && loadedScene != "App")
        {
            seq.append(canvasFader.FadeIn());
            seq.append(() => StartCoroutine(UnloadAsync()));
        }

        seq.append(() => StartCoroutine(LoadAsync(sceneName)));
        seq.append(canvasFader.FadeOut());

        return(seq.tween);
    }
Example #23
0
    private void DeathSequence()
    {
        float scaleTime = 0.1f;

        LeanTween.alpha(myGO, 0, 0.4f);
        LTSeq tweenSeq = LeanTween.sequence();

        tweenSeq.append(LeanTween.scale(myGO, Vector3.one, scaleTime));
        tweenSeq.append(LeanTween.scale(myGO, Vector3.one * 0.8f, scaleTime));
        tweenSeq.append(LeanTween.scale(myGO, Vector3.one, scaleTime));
        tweenSeq.append(LeanTween.scale(myGO, Vector3.one * 0.8f, scaleTime));
        tweenSeq.append(() =>
        {
            Destroy(myGO);
        });
    }
Example #24
0
    private void SpawnSequence(Vector3 spawnPosition)
    {
        LTSeq alphaSeq = LeanTween.sequence();

        alphaSeq.append(LeanTween.alpha(myGO, 0, 0));
        alphaSeq.append(() =>
        {
            _myTF.position = spawnPosition;
        });
        alphaSeq.append(LeanTween.alpha(myGO, 1, 0.4f));
        alphaSeq.append(() =>
        {
            ToggleCollider(true);
            Online(false);
        });
    }
Example #25
0
    private void OnPressed(int index, Content content)
    {
        for (int i = 0; i < m_Pairs.Count; i++)
        {
            Content value = m_Pairs [i];
            LTSeq   seq   = LeanTween.sequence();
            seq.append(value.transform.LeanMove(value.defaultPosition, m_Duration));

            if (i <= index)
            {
                seq.append(value.transform.LeanMove(value.defaultPosition + new Vector3(-m_ShiftInPixel, 0.0f, 0.0f), m_Duration));
            }
        }

        m_SelectedIndex = index;

        //int direction = 0;
        //int newSelectedIndex = 0;

        //for ( int i = 0; i < m_RectTransforms.Length; i++ )
        //{
        //    RectTransform rect = m_RectTransforms [ i ];

        //    if ( rect == selectedRect )
        //    {
        //        direction = ( int ) Mathf.Sign( m_SelectedIndex - i );
        //        newSelectedIndex = i;
        //        break;
        //    }
        //}

        //if ( direction == 0 )
        //{
        //    Debug.Log( "We cant choose a color twice!" );
        //    return;
        //}

        //for ( int i = m_SelectedIndex; i != newSelectedIndex; i++ )
        //{
        //    if ( i == 0 || i == m_RectTransforms.Length - 1 )
        //        continue;

        //    RectTransform rect = m_RectTransforms [ i ];
        //    LeanTween.moveX( rect.gameObject , rect.transform.position.x + m_ShiftInPixel * direction , m_Duration );
        //}
    }
Example #26
0
    public void Launch()
    {
        if (sequence != null)
        {
            return;
        }

        sequence = LeanTween.sequence();
        sequence
        .append(() => audioSource.Play())
        .append(FadeOut(0f))
        .append(FadeIn(3f))
        .append(() => background.enabled = false)
        .append(LeanTween.size(logo, new Vector2(270, 270), 5f))
        .append(FadeOut(0.5f))
        .append(() => LeanTween.dispatchEvent((int)FulementVidEventType.onFinish))
        .append(() => sequence = null);
    }
Example #27
0
    public virtual void Show(params object[] args)
    {
        gameObject.SetActive(true);

        transform.localScale = BEGIN_SCALE;

        SoundManager.Instance.PlayUISoundInstance(_soundKey);

        gameObject.LeanCancel();

        float scaleTime = _time * 0.3f;

        LTSeq sequence = LeanTween.sequence();

        sequence.append(gameObject.LeanScale(Vector3.one, scaleTime).setEaseOutBack());
        sequence.append(_time * 0.1f);
        sequence.append(gameObject.LeanScale(BEGIN_SCALE, scaleTime).setEaseInOutBack());
        sequence.append(() => gameObject.SetActive(false));
    }
Example #28
0
    public void Hide(Action callback = null)
    {
        LTSeq sequence = LeanTween.sequence();

        sequence
        .append(() => LeanTween.alphaCanvas(info, 0, duration).setEase(easeIn))
        .append(1f)
        .append(() => LeanTween.size(rt, startSize, duration).setEase(easeIn))
        .append(1f)
        .append(() =>
        {
            LeanTween.scale(rt, startScale, duration).setEase(easeIn);
            LTDescr descr = LeanTween.alphaCanvas(canvasGroup, 0, duration).setEase(easeIn);
            if (callback != null)
            {
                descr.setOnComplete(callback);
            }
        });
    }
Example #29
0
    public virtual void DoDamage(LTSeq seq, Vector2 targetPos, UnitScript currentTarget, bool retaliate = false)
    {
        float targetXOffset = currentTarget.Sprite.bounds.extents.x * (!_playerScript.IsMe ? 1 : -1);

        if (retaliate)
        {
            targetXOffset = (currentTarget.Sprite.bounds.extents.x / 4) * (!_playerScript.IsMe ? -1 : 1);
        }
        seq.append(LeanTween.moveX(gameObject, targetPos.x - targetXOffset, 0.15f)
                   .setLoopPingPong(1)
                   .setEaseInQuint());
        seq.append(() =>
                   Instantiate(_impactEffectPrefab, currentTarget.Sprite.transform));
        seq.append(() =>
        {
            _unit.Attack(currentTarget.Unit, retaliate);
        });
        seq.append(0.5f);
    }
Example #30
0
    public virtual void AnimateAttack()
    {
        Vector3 targetPos = _currentTarget.transform.position;

        targetPos.x += (_currentTarget.Sprite.bounds.size.x) * (!_playerScript.IsMe ? 1 : -1);
        LTSeq seq = LeanTween.sequence();

        seq.append(LeanTween.move(gameObject, targetPos, 0.5f));
        seq.append(0.2f);

        DoDamage(seq, targetPos, _currentTarget);
        _currentTarget.DoDamage(seq, targetPos, this, true);

        seq.append(() => _unitSprite.flipX = !_unitSprite.flipX);
        seq.append(LeanTween.moveLocal(gameObject, Vector3.zero, 0.5f));
        seq.append(() => _unitSprite.flipX = !_unitSprite.flipX);
        seq.append(() => _unit.SetGettingReady());
        seq.append(() => _unitAction = UnitAction.Idle);
    }