Exemplo n.º 1
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         Destroy(this);
     }
 }
Exemplo n.º 2
0
        public static float OutQuad(OscillationSettings settings, float time)
        {
            float phase = (settings.Frequency * time + settings.Offset) % 1f;
            float value;

            if (phase < settings.Ratio)
            {
                value = TweenUtility.OutQuad(phase / settings.Ratio);
            }
            else
            {
                value = TweenUtility.OutQuad(1f - (phase - settings.Ratio) / (1f - settings.Ratio));
            }

            return(settings.Amplitude * (value * 2f - 1f) + settings.Center);
        }
Exemplo n.º 3
0
        public virtual void Show()
        {
            SoundSystem.PlayOnce(showSound, 1.0f);
            canvasGroup.interactable   = true;
            canvasGroup.blocksRaycasts = true;
            if (showTween == null || !showTween.isAlpha)
            {
                canvasGroup.alpha = 1f;
            }
            else
            {
                TweenUtility.SetTween(gameObject, showTween, 1, () => {
                    if (canvasGroup != null)
                    {
                        canvasGroup.alpha = 1f;
                    }
                });
            }

            if (OnShowAction != null)
            {
                OnShowAction.Invoke();
            }
        }
Exemplo n.º 4
0
        public virtual void Close()
        {
            SoundSystem.PlayOnce(closeSound, 1.0f);
            canvasGroup.interactable   = false;
            canvasGroup.blocksRaycasts = false;
            if (closeTween == null || !closeTween.isAlpha)
            {
                canvasGroup.alpha = 0f;
            }
            else
            {
                TweenUtility.SetTween(gameObject, closeTween, 1, () => {
                    if (canvasGroup != null)
                    {
                        canvasGroup.alpha = 0f;
                    }
                });
            }

            if (OnCloseAction != null)
            {
                OnCloseAction.Invoke();
            }
        }