Exemplo n.º 1
0
 protected void Update()
 {
     _timer.Update(Time.deltaTime);
     if (_state == State.Closing)
     {
         transform.position = Vector3.Lerp(_openPosition, _closedPosition, MotionCurve.GetCurveForPercentComplete(_timer.t, _closeCurve));
         if (_timer.IsComplete)
         {
             _state  = State.Closed;
             enabled = false;
         }
     }
     else if (_state == State.Opening)
     {
         transform.position = Vector3.Lerp(_closedPosition, _openPosition, MotionCurve.GetCurveForPercentComplete(_timer.t, _openCurve));
         if (_timer.IsComplete)
         {
             _state  = State.Open;
             enabled = false;
         }
     }
 }
Exemplo n.º 2
0
 protected void Update()
 {
     _timer.Update(Time.deltaTime);
     if (_finishedMoving)
     {
         if (_timer.IsComplete)
         {
             Hide();
         }
     }
     else
     {
         _rectTransform.anchoredPosition = Vector2.Lerp(_hiddenPosition, _visiblePosition, MotionCurve.GetCurveForPercentComplete(_timer.t, _moveCurve));
         if (_timer.IsComplete)
         {
             _timer.StartNewTimer(_visibleDuration);
             _finishedMoving = true;
         }
     }
 }