public void SetVisibility(bool visible)
 {
     _latestVisibility = visible;
     DOTween
     .To(
         () => _deformer.Factor,
         v => _deformer.Factor = v,
         visible ? 0.0f : 0.5f,
         0.5f)
     .SetEase(Ease.OutCubic)
     .OnStart(() =>
     {
         _deformableCounter.Increment();
         if (visible)
         {
             _renderer.enabled = true;
             for (int i = 0; i < _knobRenderers.Length; i++)
             {
                 _knobRenderers[i].enabled = true;
             }
         }
     })
     .OnComplete(() =>
     {
         _renderer.enabled = _latestVisibility;
         for (int i = 0; i < _knobRenderers.Length; i++)
         {
             _knobRenderers[i].enabled = _latestVisibility;
         }
         _deformableCounter.Decrement();
     });
 }
 private void SetGamepadVisibility(bool visible)
 {
     _latestVisibility = visible;
     DOTween
     .To(
         () => _deformer.Factor,
         v => _deformer.Factor = v,
         visible ? 0.0f : 0.5f,
         0.5f)
     .SetEase(Ease.OutCubic)
     .OnStart(() =>
     {
         _deformableCounter.Increment();
         if (visible)
         {
             foreach (var r in _renderers)
             {
                 r.enabled = true;
             }
         }
     })
     .OnComplete(() =>
     {
         _deformableCounter.Decrement();
         foreach (var r in _renderers)
         {
             r.enabled = _latestVisibility;
         }
     });
 }
Example #3
0
 public void SetVisibility(bool visible)
 {
     _latestVisibility = visible;
     DOTween
     .To(
         () => _deformer.Factor,
         v => _deformer.Factor = v,
         visible ? 0.0f : 1.0f,
         0.5f)
     .SetEase(Ease.OutCubic)
     .OnStart(() =>
     {
         _deformableCounter.Increment();
         if (visible)
         {
             _renderer.enabled = true;
         }
     })
     .OnComplete(() =>
     {
         _deformableCounter.Decrement();
         _renderer.enabled = _latestVisibility;
     });
 }