Пример #1
0
 void Update()
 {
     transform.localPosition = initialPosition + (1 + startup) * new Vector3(0.05f * Mathf.Sin(0.837f * Time.time + startup), 0.1f * Mathf.Sin(Time.time + startup), 0.023f * Mathf.Sin(0.776f * Time.time + startup));
     if (popping)
     {
         float time    = 0.5f * (Time.time - popTime);
         float expTime = Smoothing.ExponentialEaseOut(time);
         meshRenderer.material.SetFloat("_Explosion", expTime);
         collider.enabled = false;
         if (time > 1)
         {
             gameObject.SetActive(false);
         }
     }
 }
Пример #2
0
 void Update()
 {
     if (animating)
     {
         time = Mathf.Clamp01(Time.deltaTime + time);
         float val = Smoothing.ExponentialEaseOut(time);
         val = val * xTarget + (1 - val) * xStart;
         uiTransform.RelativePosition = new Vector2(val, 0);
         if (time == 1)
         {
             animating = false;
             if (!activating)
             {
                 gameObject.SetActive(false);
             }
         }
     }
 }