Пример #1
0
    void Update()
    {
        countDownToTurnOff -= Time.deltaTime;
        if (countDownToTurnOff > 0)
        {
            lerpFactor = countDownToTurnOff / totalLerpDuration;

            if (lerpTransform)
            {
                if (desiredLocalPosition != Vector3.zero)
                {
                    transform.localPosition = lerp.Lerp(lerpPosA, lerpPosB, 1 - lerpFactor);
                }

                if (desiredLocalRotation != Vector3.zero)
                {
                    transform.localEulerAngles = lerp.Lerp(lerpEulerA, lerpEulerB, 1 - lerpFactor);
                }

                if (desiredLocalScale != Vector3.zero)
                {
                    transform.localScale = lerp.Lerp(lerpScaleA, lerpScaleB, 1 - lerpFactor);
                }
            }

            if (lerpColor && desiredColor != Color.black && myImage)
            {
                myImage.color = lerp.Lerp(lerpColorA, lerpColorB, 1 - lerpFactor);
            }
        }
    }
Пример #2
0
        private IEnumerator BeginFade(Color startCol, Color endCol, float duration)
        {
            // Fading is now happening.  This ensures it won't be interupted by non-coroutine calls.
            m_IsFading = true;

            // Execute this loop once per frame until the timer exceeds the duration.
            float timer = 0f;

            while (timer <= duration)
            {
                // Set the colour based on the normalised time.
                m_FadeImage.color = lerp.Lerp(startCol, endCol, timer / duration);

                // Increment the timer by the time between frames and return next frame.
                timer += Time.deltaTime;
                yield return(null);
            }

            // Fading is finished so allow other fading calls again.
            m_IsFading = false;

            // If anything is subscribed to OnFadeComplete call it.
            if (OnFadeComplete != null)
            {
                OnFadeComplete();
            }
        }
Пример #3
0
 void Update()
 {
     timeCounter         += Time.deltaTime * currentSpeed;
     myRect.localRotation = Quaternion.Euler(0, 0, lerp.Lerp(initialZ, finalZ, timeCounter));// Rotate(0, 0, currentSpeed * Time.deltaTime, Space.Self);
     if (timeCounter > 1)
     {
         timeCounter = 0;
     }
 }
Пример #4
0
 void Update()
 {
     countDownToTurnOff -= Time.deltaTime;
     if (countDownToTurnOff > 0)
     {
         lerpFactor             = countDownToTurnOff / totalLerpDuration;
         myColor                = myImageComponent.color;
         myColor.a              = lerp.Lerp(lerpA, lerpB, 1 - lerpFactor);
         myImageComponent.color = myColor;
     }
 }
Пример #5
0
 private void Update()
 {
     if (countDownToTurnOff > 0)
     {
         countDownToTurnOff -= Time.deltaTime;
         lerpFactor          = countDownToTurnOff / totalLerpDuration;
         float value = lerp.Lerp(lerpA, lerpB, 1 - lerpFactor);
         skinnedMeshRenderer.SetBlendShapeWeight(blendShapeIndex, value);
         if (countDownToTurnOff < 0)
         {
             OnFinish();
         }
     }
 }
Пример #6
0
 void Update()
 {
     if (countDownToTurnOff > 0)
     {
         countDownToTurnOff -= Time.deltaTime;
         lerpFactor          = countDownToTurnOff / totalLerpDuration;
         if (pullOrPush)
         {
             lerpPosB = CalculateDestiny();
         }
         currentObjectBeingMoved.position = lerp.Lerp(lerpPosA, lerpPosB, 1 - lerpFactor);
         if (countDownToTurnOff < 0)
         {
             Finished();
         }
     }
 }