value() 공개 정적인 메소드

public static value ( GameObject gameObject, object>.Action callOnUpdate, Color from, Color to, float time ) : LTDescr
gameObject GameObject
callOnUpdate object>.Action
from Color
to Color
time float
리턴 LTDescr
예제 #1
0
        /// <summary>
        /// Start fading the gameobject's recttransform
        /// </summary>
        public void FadeGroup(bool fadeIn)
        {
            FadeStyle fade = fadeIn ? FadeStyle.FadeIn : FadeStyle.FadeOut;

            switch (fade)
            {
            case FadeStyle.FadeIn:
                if (loop)
                {
                    LeanTween.value(gameObject, minMaxAlpha.x, minMaxAlpha.y, duration).setOnUpdate((float val) => { group.alpha = val; }).setEase(easingStyle).setLoopPingPong();
                }
                else
                {
                    LeanTween.value(gameObject, minMaxAlpha.x, minMaxAlpha.y, duration).setOnUpdate((float val) => { group.alpha = val; }).setEase(easingStyle);
                }
                break;

            case FadeStyle.FadeOut:
                if (loop)
                {
                    LeanTween.value(gameObject, minMaxAlpha.y, minMaxAlpha.x, duration).setOnUpdate((float val) => { group.alpha = val; }).setEase(easingStyle).setLoopPingPong();
                }
                else
                {
                    if (gameObject.activeInHierarchy)
                    {
                        LeanTween.value(gameObject, minMaxAlpha.y, minMaxAlpha.x, duration).setOnUpdate((float val) => { group.alpha = val; }).setEase(easingStyle).setOnComplete(() => { if (inactiveOnTransparent)
                                                                                                                                                                                          {
                                                                                                                                                                                              gameObject.SetActive(false);
                                                                                                                                                                                          }
                                                                                                                                                                                  });
                    }
                }
                break;
            }
        }
예제 #2
0
    IEnumerator CO_TestLTCompleteBy(bool byTarget, bool tweenFloatValue)
    {
        Debug.Log(string.Format("{0} :: Create {1} tweens on {2}", Time.realtimeSinceStartup, totTweens, (tweenFloatValue ? "float" : "transform")));
        for (int i = 0; i < totTweens; ++i)
        {
            LTDescr lt = tweenFloatValue ? LeanTween.value(floatValue, 2.0f, 10.0f) : LeanTween.moveLocalX(go, 2.0f, 10.0f);

            if (!byTarget)
            {
                lt.setId((uint)i, 0);
            }
        }
        yield return(new WaitForSeconds(2f));

        Debug.Log(string.Format("{0} :: Complete {1} tweens by {2}", Time.realtimeSinceStartup, totTweens, (byTarget ? "target" : "id")));

        float time = Time.realtimeSinceStartup;

        LeanTween.cancelAll();

        float elapsed = Time.realtimeSinceStartup - time;

        Debug.Log(string.Format("{0} :: Completed {1} tweens in {2} [ms]", Time.realtimeSinceStartup, totTweens, elapsed * 1000.0f));
    }
예제 #3
0
 public override void Hide()
 {
     _isHiding = true;
     _canvasGroup.interactable = false;
     //MusicManager.playSound("popup_show_hide");
     LeanTween.value(gameObject, _canvasGroup.alpha, 0.0f, UIConsts.HIDE_TWEEN_TIME)
     //.setDelay(UIConsts.HIDE_DELAY_TIME)
     .setOnUpdate(
         (float val) =>
     {
         _canvasGroup.alpha = val;
     }
         ).setOnComplete
     (
         () =>
     {
         GameManager.Instance.EventManager.CallOnHideWindowEvent();
         gameObject.SetActive(false);
         Active    = false;
         _isHiding = false;
         OnHided();
     }
     );
 }
예제 #4
0
    private void ConnectConnector(ConnectorDragAndDrop connector)
    {
        Transform connectorTransform = connector.transform;
        Vector3   stuff = transform.eulerAngles - connectorTransform.eulerAngles;
        Vector3   rot   = connectorTransform.transform.eulerAngles;
        Vector3   tmp   = new Vector3();

        LeanTween.value(gameObject, Vector3.zero, stuff, rotationTime).setOnUpdate((Vector3 angleOffset) =>
        {
            tmp.Set(rot.x + angleOffset.x, rot.y + angleOffset.y, rot.z + angleOffset.z);
            connectorTransform.eulerAngles = tmp;
        })
        .setEase(rotationEaseType);

        Vector3 pos    = transform.position - connectorTransform.position - transform.forward * 0.15f;
        Vector3 oldPos = connectorTransform.position;

        LeanTween.value(gameObject, Vector3.zero, pos, positionTime).setOnUpdate((Vector3 newPos) =>
        {
            connectorTransform.position = oldPos + newPos;
        })
        .setEase(positionEaseType)
        .setOnComplete(() => { OnDustSuckerConnectionChanged(connector); });
    }
예제 #5
0
    void Hide()
    {
        if (root.activeSelf)
        {
            if (fwoosh != null && activeOpen)
            {
                LeanAudio.play(fwoosh);
            }
            Vector3 targetPos = GetAdjustedPlayerScreenPos() + Vector3.right * 32 + Vector3.down * 6;
            //LeanTween.move(rootRect, playerPos, 0.25f).setEase(LeanTweenType.easeInExpo);
            LeanTween.delayedCall(animationTime * 0.152f, () => {
                LeanTween.value(root, MoveRoot, savedPos, targetPos, animationTime * 0.454f).setEase(LeanTweenType.easeInExpo);
            });

            LeanTween.scale(root, Vector3.one * 0.2f, animationTime * 0.606f).setEase(LeanTweenType.easeInBack);
            LeanTween.scale(comicTail, Vector3.one * 5, animationTime * 0.606f).setEase(LeanTweenType.easeInCirc).setOnComplete(() => {
                root.SetActive(false);                  /*smallButton.gameObject.SetActive (true);*/
            });
            //root.SetActive (false);
            //Debug.Break ();
            isShowing = false;
            hideCount++;
        }
    }
        private void ShootFragment(bool avoidFragmentCollider = true)
        {
            DoSquishyAnimation();

            var     fragment     = CreateFragment();
            Vector3 startPos     = transform.position;
            Vector3 endPos       = GetPointWithinInfluence(avoidFragmentCollider);
            Vector3 controlPoint = startPos + (endPos - startPos) * 0.5f + Vector3.up;

            fragment.transform.position = startPos;

            var seq2 = LeanTween.sequence();

            seq2.append(
                LeanTween.value(gameObject, 0, 1, shootDuration)
                .setOnUpdate((float val) =>
            {
                Vector2 targetPos           = Util.Bezier2(startPos, controlPoint, endPos, val);
                fragment.transform.position = targetPos;
            })
                .setEaseInSine()
                );

            seq2.append(LeanTween.moveY(fragment, endPos.y + 0.06f, 0.1f));
            seq2.append(LeanTween.moveY(fragment, endPos.y, 0.1f));

            seq2.append(() =>
            {
                if (Util.tutCanvas.hasTutorials && Util.tutCanvas.currTutorial.highlightedItem == HighlightedItem.MINI_CHLORO)
                {
                    Util.poolManager.SpawnItemHighlight(fragment.transform.position, new Vector2(0, 120));
                }
            });

            EventManager.Structures.onLightDropped?.Invoke();
        }
예제 #7
0
    IEnumerator returnHook()
    {
        LeanTween.value(8, 20, 0.75f).setOnUpdate((float val) => { speed = val; }).setEaseOutCirc();
        angleTravel += Mathf.PI;
        bossObject.TriggerThrowback();
        while (Vector2.Distance(transform.position, handPosition) > 1)
        {
            if (closed)
            {
                PlayerProperties.playerShip.transform.position += new Vector3(Mathf.Cos(angleTravel), Mathf.Sin(angleTravel)) * speed * Time.deltaTime;
            }

            lineRenderer.SetPosition(0, transform.position);
            lineRenderer.SetPosition(1, handPosition);
            transform.position += (this.handPosition - transform.position).normalized * speed * Time.deltaTime;
            yield return(null);
        }

        if (closed)
        {
            PlayerProperties.playerScript.removeRootingObject();
        }
        Destroy(this.gameObject);
    }
예제 #8
0
    IEnumerator SlamFistProcedure(Vector3 toPosition, bool turnOffDamageHitbox, UnityAction betweenAction)
    {
        animator.Play("Fist Rise");
        LeanTween.value(0, 0.06f, 8 / 12f).setOnUpdate((float val) => { shadow.transform.localScale = new Vector3(val, val); });
        yield return(new WaitForSeconds(8 / 12f));

        obstacleHitbox.SetActive(false);

        while (Vector2.Distance(transform.position, PlayerProperties.playerShipPosition) > 0.2f)
        {
            transform.position += (PlayerProperties.playerShipPosition - transform.position).normalized * Time.deltaTime * 12f;
            yield return(null);
        }

        PlayerProperties.playerScript.windowAlreadyOpen = true;

        betweenAction.Invoke();

        animator.Play("Fist Slam");

        LeanTween.value(0.06f, 0f, 2 / 12f).setOnUpdate((float val) => { shadow.transform.localScale = new Vector3(val, val); });

        yield return(new WaitForSeconds(2 / 12f));

        obstacleHitbox.SetActive(true);
        splashAudio.Play();
        if (!turnOffDamageHitbox)
        {
            damageHitbox.SetActive(true);
        }

        yield return(new WaitForSeconds(1 / 12f));

        damageHitbox.SetActive(false);
        yield return(new WaitForSeconds(4 / 12f));
    }
예제 #9
0
    private IEnumerator StartSequence()
    {
        DisableVisuals();
        SetAlpha(0.0f);
        LeanTween.cancel(visualObjects.gameObject);
        yield return(WaitCache.WaitForSeconds(0.5f));

        var randomScale = Random.Range(0.2f, 2.0f);

        SetVisualScale(randomScale);
        EnableVisuals();

        // scale the brick up from tiny.

        targetScale = 1.0f;

        var timeToTake = Random.Range(0.3f, 0.5f);

        LeanTween.value(0.0f, 1.0f, timeToTake).setOnUpdate(SetPercent)
        .setEase(LeanTweenType.easeOutBack)
        .setDelay(delayCounter);

        yield return(WaitCache.WaitForSeconds(timeToTake));
    }
예제 #10
0
    IEnumerator swordDash(float angleAttack)
    {
        yield return(new WaitForSeconds(4 / 12f));

        polyCol.enabled = true;

        rigidBody2D = GetComponent <Rigidbody2D>();

        LeanTween.value(0, 12, 0.8f).setOnUpdate((float val) => { moveTowards(angleAttack, val); });

        float period = 0;

        while (period < 1.6f)
        {
            moveTowards(angleAttack, 12);
            period += Time.deltaTime;
            yield return(null);
        }

        polyCol.enabled = false;
        LeanTween.value(12, 0, 0.5f).setOnUpdate((float val) => { moveTowards(angleAttack, val); });
        animator.SetTrigger("Shatter");
        Destroy(this.gameObject, 4 / 12f);
    }
예제 #11
0
    //1. Silicon
    //Make Silicon fade In then change rendering mode to opaque
    void Setp1Silicon()
    {
        Debug.Log("Setp1Silicon");

        SiliconMat.SetFloat("_Mode", 2f); //rendering mode to Fade

        tempCol          = SiliconMat.color;
        tempCol.a        = alpha0;
        SiliconMat.color = tempCol;

        Silicon.SetActive(true);

        LeanTween.value(Silicon, alpha0, alpha1, 3f).setOnUpdate((float val) =>
        {
            tempCol          = SiliconMat.color;
            tempCol.a        = val;
            SiliconMat.color = tempCol;
        }).setOnComplete(() =>
        {
            //Set the rendering mode to Opaque
            SiliconMat.SetFloat("_Mode", 0f);
            Step2APolySilicon();
        });
    }
예제 #12
0
        protected void Hide(Stage stage)
        {
            if (fadeDuration == 0)
            {
                fadeDuration = float.Epsilon;
            }

            LeanTween.value(gameObject, 1, 0, fadeDuration).setOnUpdate(
                (float fadeAmount) => {
                foreach (Character c in stage.charactersOnStage)
                {
                    c.state.portraitImage.material.SetFloat("_Alpha", fadeAmount);
                }
            }
                ).setOnComplete(
                () => {
                foreach (Character c in stage.charactersOnStage)
                {
                    c.state.portraitImage.material.SetFloat("_Alpha", 0);
                }
                OnComplete();
            }
                );
        }
예제 #13
0
    /// <summary> Showing more stuff about player. </summary>
    private void Unfold()
    {
        if (!animating)
        {
            return;
        }
        unfolding = true;

        // Longening width
        LeanTween.value(this.gameObject, (this.transform as RectTransform).sizeDelta.x, widthEnlarged, .05f)
        .setOnUpdate(
            ( float val ) =>
            //(transform as RectTransform).SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, val)
            GetComponent <LayoutElement>().preferredWidth = val
            )
        // Showing eq
        .setOnComplete(() =>
        {
            if (unfolding)
            {
                LeanTween.scale(eqPanel, Vector3.one, .1f);
            }
        });
    }
예제 #14
0
    void tapTwice()
    {
        d.OnSingleTap -= Change;
        CanvasGroup cg = GetComponent <CanvasGroup>();

        cg.alpha = 0;
        LeanTween.cancel(pointer.gameObject);
        pointer.gameObject.SetActive(false);
        face.gameObject.SetActive(true);
        speechBbl.gameObject.SetActive(true);
        speech.text = "tap twice to change things up!";
        //rescale + rotate

        LeanTween.value(speechBbl.gameObject, (float val) =>
        {
            cg.alpha = val;
            speechBbl.rectTransform.localScale  = Vector3.one * val;
            speechBbl.rectTransform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(-90, 0, val));
        }, 0.3f, 1f, 0.4f).setEaseOutQuart().setOnComplete(() =>
        {
            d.OnSingleTap += Change;
            StartCoroutine(bounce());
        });
    }
예제 #15
0
    IEnumerator randomFollowRoutine(GameObject trail, Vector3 position)
    {
        TrailRenderer trailRenderer = trail.GetComponent <TrailRenderer>();

        trailRenderer.startWidth = 0.4f;
        float startSpeed = Random.Range(2, 10);
        float speed      = startSpeed;

        LeanTween.value(startSpeed, 20, 3f).setOnUpdate((float val) => { speed = val; }).setEaseOutCirc();

        while (Vector2.Distance(trail.transform.position, position) > 0.5f)
        {
            float angle = Mathf.Atan2(position.y - trail.transform.position.y, position.x - trail.transform.position.x) + Mathf.PI / 2;
            trail.transform.position += (new Vector3(Mathf.Cos(angle), Mathf.Sin(angle)) + (position - trail.transform.position)).normalized * speed * Time.deltaTime;
            yield return(null);
        }

        LeanTween.value(trailRenderer.startWidth, 0, 0.25f).setOnUpdate((float val) => { trailRenderer.startWidth = val; });
        trail.GetComponent <Animator>().SetTrigger("Dissapear");

        yield return(new WaitForSeconds(0.5f));

        trail.SetActive(false);
    }
예제 #16
0
    public void UndoPlayerSelect()
    {
        //board.HideCover();
        //Debug.Log("Deselect: " + name);

        board.gameManager.HideCardControls();
        Vector2 targetPos = movedPosition;

        movedPosition = Vector2.zero;
        LeanTween.moveLocal(gameObject, targetPos, 0.1f)
        .setEase(LeanTweenType.easeInQuad);

        Vector2 targetSize = movedSize;

        movedSize = Vector2.zero;
        LeanTween.value(gameObject, GetComponent <RectTransform>().sizeDelta, targetSize, 0.1f)
        .setEase(LeanTweenType.easeInQuad)
        .setOnUpdateVector2((Vector2 val) =>
        {
            GetComponent <RectTransform>().sizeDelta = val;
            ResizeText(val);
        });
        board.ResetValidCells();
    }
예제 #17
0
    public void FocusOnPlanet(float duration, RectTransform setFocusElement = null)
    {
        RectTransform focusedElement = setFocusElement ?? GetFocussedElement();

        if (focusedElement.gameObject.tag == "sun")
        {
            focusedElement = (RectTransform)content.transform.GetChild(1).transform;
        }

        planetNameText.text = focusedElement.gameObject.name;
        velocity            = Vector2.zero;

        float startPosition = content.anchoredPosition.x;
        float endPosition   = -focusedElement.localPosition.x;

        LeanTween.value(content.gameObject, startPosition, endPosition, duration)
        .setEase(LeanTweenType.easeInOutSine)
        .setOnUpdate((value) => content.anchoredPosition = new Vector2(value, content.anchoredPosition.y))
        .setOnComplete(() => velocity = Vector2.zero);
        LeanTween.alphaCanvas(planetNameCanvasGroup, 1, duration);

        ViewPlanet.Instance.currentViewingLocation = focusedElement.GetComponent <PlanetElement>().Planet;
        planetInfo.Display(ViewPlanet.Instance.currentViewingLocation);
    }
예제 #18
0
        public override void OnConnectedToMaster()
        {
            if (GlobalValues.Connected)
            {
                return;
            }

            GlobalValues.SetConnected(true);

            PhotonNetwork.AutomaticallySyncScene = true;

            loadingBtn.GetComponent <LoadingBtnController>().StopLoadingAnimation();
            loadingBtn.GetComponent <LoadingBtnController>().SetText($"Connected!");
            Image img = loadingBtn.GetComponent <Image>();

            LeanTween.color(img.rectTransform, new Color32(0, 250, 126, 255), 0.7f).setOnComplete(() =>
            {
                LeanTween.moveLocalY(backBtn, backBtn.transform.localPosition.y - 55 - 10, buttonAnimationTime)
                .setEase(buttonEaseType);

                LeanTween.moveLocalY(createRoomBtn, createRoomBtn.transform.localPosition.y - 55 - 10, buttonAnimationTime)
                .setEase(buttonEaseType);

                LeanTween.alpha(loadingBtn.GetComponent <Image>().rectTransform, 0, buttonAnimationTime)
                .setEase(buttonEaseType).setOnComplete(() => loadingBtn.SetActive(false));

                TextMeshProUGUI loadingBtnText = loadingBtn.transform.GetChild(0).GetComponent <TextMeshProUGUI>();

                LeanTween.value(loadingBtnText.gameObject, a =>
                {
                    Color32 textColor    = loadingBtnText.color;
                    textColor.a          = (byte)a;
                    loadingBtnText.color = textColor;
                }, 255, 0, 0.2f);
            });
        }
예제 #19
0
    public void PlayHitpointChange(int oldHitpoints, int newHitpoints, Action onFinished)
    {
        MoveAnd(() => {
            ZoomInAnd(() => {
                playDamagedSound();
                LeanTween.value(gameObject, Color.white, Color.red, 0.5f)
                .setLoopOnce()
                .setEaseInOutCubic()
                .setOnUpdate((color) => {
                    GetComponent <SpriteRenderer>().color = color;
                })
                .setOnComplete(RemoveHitpointColorAnimation);

                LeanTween.value(gameObject, (float)oldHitpoints, (float)newHitpoints, 0.5f)
                .setLoopOnce()
                .setEaseInOutCubic()
                .setOnUpdate((value) => {
                    var hitpoints = (int)Math.Round(value);
                    UpdateHitpointsInTextMesh(hitpoints);
                })
                .setOnComplete(onFinished);
            });
        });
    }
예제 #20
0
    public void AppearAndDisappear(float time = 0.5f, float appearTime = 0.0f)
    {
        this.gameObject.SetActive(true);

        if (this.GetComponent <Collider>() != null)
        {
            this.GetComponent <Collider>().enabled = true;
        }

        CancelSpriteAlphaLT();

        spriteAlphaLT = LeanTween.value(sprite.alpha, 1.0f, time).setOnUpdate((v) => {
            sprite.alpha = v;
        }).setOnComplete(() => {
            spriteAlphaLT = LeanTween.value(sprite.alpha, 0.0f, time).setOnUpdate((v) => {
                sprite.alpha = v;
            }).setOnComplete(() => {
                if (eventAnimState != null)
                {
                    eventAnimState(AnimState.Disapper_COMPLETE);
                }
            });
        });
    }
예제 #21
0
    private void TriggerRuleBreak()
    {
        if (!isRuleDisplayed)
        {
            TriggerRule();
        }
        float breakDuration = 1.5f;
        float returnTime    = 0.5f;

        textDisplay.shakeEffect.TriggerShake(breakDuration);
        isRuleBroken = true;

        // move cam
        ruleCam.gameObject.SetActive(true);
        TextMeshPro tm = textDisplay.displayObj;
        float       originalFontSize = tm.fontSize;

        LeanTween.value(gameObject, tm.fontSize, tm.fontSize + 2.0f, breakDuration).setOnUpdate((float val) => { tm.fontSize = val; });
        LeanTween.delayedCall(breakDuration, () => {
            //Toolbox.Instance.camMod.ShakeCam(-1, -1, ruleCam);
            Toolbox.Instance.camMod.ShakeCam(0.25f, 2.0f, ruleCam);
            tm.fontSize = originalFontSize;
            textDisplay.displayObj.fontStyle = TMPro.FontStyles.Strikethrough;

            // particles
            textDisplay.displayObj.GetComponentInChildren <ParticleSystem>().Play();
            Toolbox.Instance.SfxMan.PlaySoundWithPitch("RuleBreak", 0.9f, 1.1f, 0.25f);

            ruleCam.gameObject.SetActive(false);

            LeanTween.delayedCall(returnTime, () => {
                nc.TriggerRuleBreak();
                //LeanTween.value(gameObject, tm.fontSize, originalFontSize, 2.0f).setOnUpdate( (float val)=>{ tm.fontSize = val; } );
            });
        });
    }
예제 #22
0
    public void Appear(float time = 0.5f, float delay = 0.0f, System.Action completeAct = null)
    {
        this.gameObject.SetActive(true);

        if (this.GetComponent <Collider>() != null)
        {
            this.GetComponent <Collider>().enabled = true;
        }

        CancelSpriteAlphaLT();

        spriteAlphaLT = LeanTween.value(sprite.alpha, 1.0f, time).setDelay(delay).setOnUpdate((v) => {
            sprite.alpha = v;
        }).setOnComplete(() => {
            if (eventAnimState != null)
            {
                eventAnimState(AnimState.Appear_COMPLETE);
            }
            if (completeAct != null)
            {
                completeAct();
            }
        });
    }
예제 #23
0
 public void MoveElementInScrollArea(int index, bool moveImmediately)
 {
     if ((index >= 0) && (index < this.m_elementAmount))
     {
         Vector2 zero    = Vector2.zero;
         Vector2 vector2 = Vector2.zero;
         stRect  rect    = !this.m_useOptimized ? this.m_elementScripts[index].m_rect : this.m_elementsRect[index];
         vector2.x = this.m_contentRectTransform.anchoredPosition.x + rect.m_left;
         vector2.y = this.m_contentRectTransform.anchoredPosition.y + rect.m_top;
         if (vector2.x < 0f)
         {
             zero.x = -vector2.x;
         }
         else if ((vector2.x + rect.m_width) > this.m_scrollAreaSize.x)
         {
             zero.x = this.m_scrollAreaSize.x - (vector2.x + rect.m_width);
         }
         if (vector2.y > 0f)
         {
             zero.y = -vector2.y;
         }
         else if ((vector2.y - rect.m_height) < -this.m_scrollAreaSize.y)
         {
             zero.y = -this.m_scrollAreaSize.y - (vector2.y - rect.m_height);
         }
         if (moveImmediately)
         {
             this.m_contentRectTransform.anchoredPosition += zero;
         }
         else
         {
             Vector2 to = this.m_contentRectTransform.anchoredPosition + zero;
             LeanTween.value(base.gameObject, pos => this.m_contentRectTransform.anchoredPosition = pos, this.m_contentRectTransform.anchoredPosition, to, this.m_fSpeed);
         }
     }
 }
예제 #24
0
        public void Show(Vector3 pos, Direction dir)
        {
            Hide(() => {
                transform.localPosition = _initPos + pos;
                var move = transform.localPosition + dir.Vector() * MoveDistance;

                _moveTween = LeanTween.moveLocal(gameObject, move, Time)
                             .setDelay(Delay)
                             .setEase(LeanTweenType.easeInOutSine)
                             .setLoopCount(-1)
                             .setOnCompleteOnStart(true)
                             .setOnCompleteOnRepeat(true)
                             .setOnComplete(() => {
                    LeanTween.cancel(_colorTween);
                    _colorTween = LeanTween.value(0f, _initColor.a, Time / 2f)
                                  .setDelay(Delay)
                                  .setEase(LeanTweenType.easeInOutSine)
                                  .setLoopPingPong(1)
                                  .setOnUpdate(a => _spriteRenderer.color = Colorizer.Alpha(_spriteRenderer.color, a))
                                  .id;
                })
                             .id;
            });
        }
예제 #25
0
 protected void PauseLoop()
 {
     if (fadeDuration > 0)
     {
         LeanTween.value(audioSource.gameObject, audioSource.volume, 0, fadeDuration
                         ).setOnUpdate(
             (float updateVolume) => {
             audioSource.volume = updateVolume;
         }
             ).setOnComplete(
             () => {
             audioSource.GetComponent <AudioSource>().Pause();
             if (waitUntilFinished)
             {
                 Continue();
             }
         }
             );
     }
     else
     {
         audioSource.GetComponent <AudioSource>().Pause();
     }
 }
예제 #26
0
    public void OnClose()
    {
        GameObject.Find("LevelController").GetComponent <PauseMenu>().canMenu = true;

        GameObject.Find("LevelController").GetComponent <PauseMenu>().HideUI(false);


        LeanTween.scale(gameObject, new Vector3(6.675f, 0f, 0f), 0.25f).setOnComplete(DestroyMe).setIgnoreTimeScale(true);
        LeanTween.value(gameObject, -150, -350, 0.25f).setIgnoreTimeScale(true).setOnUpdate((float val) => {
            GetComponent <RectTransform>().anchoredPosition3D = new Vector3(0, val, 0);
        });
        GameObject.Find("Crosshair").GetComponent <SpriteRenderer>().enabled       = true;
        GameObject.Find("RootShoot").GetComponent <Shoot>().shootEnable            = true;
        GameObject.Find("Player").GetComponent <PlayerController>().interactEnable = true;
        GameObject.Find("LevelController").GetComponent <PauseMenu>().inInventory  = false;
        Time.timeScale = 1;



        GameObject.Find("Player").GetComponent <PlayerController>().midTele = false;
        GameObject.Find("RootShoot").GetComponent <Shoot>().shootEnable     = true;
        // tiedInteractable.GetComponent<Interactable>().clicked = true;
        //tiedInteractable.GetComponent<Interactable>().canInteract = true;
    }
예제 #27
0
 protected virtual void StopLoop(AudioSource source)
 {
     if (fadeDuration > 0)
     {
         LeanTween.value(source.gameObject, _audioSource.Value.volume, 0, fadeDuration
                         ).setOnUpdate(
             (float updateVolume) => {
             source.volume = updateVolume;
         }
             ).setOnComplete(
             () => {
             source.GetComponent <AudioSource>().Stop();
             if (waitUntilFinished)
             {
                 Continue();
             }
         }
             );
     }
     else
     {
         source.GetComponent <AudioSource>().Stop();
     }
 }
예제 #28
0
    private void HandleNextChange()
    {
        // Background circle
        NavigationInformation info = GetInfoOfCurrentlySelected();

        LeanTween.value(characterBackgroundCircle.gameObject, characterBackgroundCircle.color, info.PressedColor, tweenTime)
        .setEase(easeType)
        .setOnUpdate((Color val) => {
            characterBackgroundCircle.color = val;
        });

        // Right arrow size tween
        NavigationInformation arrowInfo = rightArrow.GetComponent <NavigationInformation>();

        LeanTween.scale(rightArrow.rectTransform, arrowInfo.PressedScale, tweenTime * 0.5f).setEase(easeType)
        .setOnComplete(() => {
            LeanTween.scale(rightArrow.rectTransform, arrowInfo.OriginalScale, tweenTime * 0.5f).setEase(easeType);
        });
        LeanTween.color(rightArrow.rectTransform, arrowInfo.PressedColor, tweenTime * 0.5f).setEase(easeType)
        .setOnComplete(() => {
            LeanTween.color(rightArrow.rectTransform, arrowInfo.NormalColor, tweenTime * 0.5f).setEase(easeType);
        });

        // Character tweens
        ImageData oldCurrent = characters[CalculateIndex(menuManager.Selector.Current - 1)];

        TweenElement(oldCurrent.rect,
                     oldCurrent.originalPosition,
                     oldCurrent.originalPosition + new Vector2(sideGap, 0f));

        ImageData newCurrent = characters[menuManager.Selector.Current];

        TweenElement(newCurrent.rect,
                     newCurrent.originalPosition - new Vector2(sideGap, 0f),
                     newCurrent.originalPosition);
    }
예제 #29
0
        /// <summary>
        /// Fades the game music volume to required level over a period of time.
        /// </summary>
        /// <param name="volume">The new music volume value [0..1]</param>
        /// <param name="duration">The length of time in seconds needed to complete the volume change.</param>
        /// <param name="onComplete">Delegate function to call when fade completes.</param>
        public virtual void SetAudioVolume(float volume, float duration, System.Action onComplete)
        {
            if (Mathf.Approximately(duration, 0f))
            {
                if (onComplete != null)
                {
                    onComplete();
                }
                audioSource.volume = volume;
                return;
            }

            LeanTween.value(gameObject,
                            audioSource.volume,
                            volume,
                            duration).setOnUpdate((v) => {
                audioSource.volume = v;
            }).setOnComplete(() => {
                if (onComplete != null)
                {
                    onComplete();
                }
            });
        }
예제 #30
0
        public LTDescr TweenOverlayAlpha(float fromAlpha, float toAlpha, float time = 0.4f)
        {
            if (mpr == null)
            {
                mpr = new MaterialPropertyBlock();
            }
            LeanTween.cancel(BlackOverlay.gameObject);
            var desc = LeanTween.value(BlackOverlay.gameObject, fromAlpha, toAlpha, time).setOnUpdate((f) => {
                mpr.SetColor("_Color", new Color(0, 0, 0, f));
                BlackOverlay.SetPropertyBlock(mpr);
            }).setOnComplete(() => {
                if (Mathf.Approximately(toAlpha, 0f))
                {
                    BlackOverlay.gameObject.SetActive(false);
                }
            });

            if (toAlpha > 0f)
            {
                BlackOverlay.gameObject.SetActive(true);
            }

            return(desc);
        }