Example #1
0
 private void TryToStartSlowmotion()
 {
     if (m_slowmotion.CanStartSlowmotion)
     {
         UIViewSwitcher.GetUIViewSwitcher().ChangeColorAdjustmentsInOneFrame(true);
         m_slowmotion.StartSlowmotion();
         StartCoroutine(VisualizeSlowmotionTime());
     }
 }
Example #2
0
 private void Start()
 {
     m_slowmotion = FindObjectOfType <Slowmotion>();
     m_startSlowmotionButton.OnClick.AddListener(TryToStartSlowmotion);
     m_startSlowmotionButton.OnClickUp.AddListener(StopVisualizingSlowmotionTime);
     m_slowmotion.Player.OnDeath += (death) =>
     {
         UIViewSwitcher.GetUIViewSwitcher().ChangeColorAdjustmentsInOneFrame(false);
         Destroy(m_slowmotionCooldownIndicatorImage);
     };
 }
Example #3
0
 private void StopVisualizingSlowmotionTime()
 {
     if (!m_slowmotion.IsSlowmotionStopped)
     {
         m_slowmotion.StopSlowmotion();
     }
     UIViewSwitcher.GetUIViewSwitcher().ChangeColorAdjustmentsInOneFrame(false);
     m_startSlowmotionButton.enabled           = false;
     m_slowmotionTimeIndicatorImage.fillAmount = 0;
     m_startSlowmotionButton.GetComponent <Button>().enabled = false;
     StartCoroutine(VisualizeCooldown());
 }
        public IEnumerator LookOnTarget(Vector3 finalPosition, Vector3 finalRotation, float time, UnityEvent OnEndEvent)
        {
            UIViewSwitcher.GetUIViewSwitcher().ClearCurrentView();
            float      t             = 0;
            Quaternion startRotation = transform.rotation;
            Vector3    startPosition = transform.position;

            while (t < 1)
            {
                t += Time.deltaTime / time;
                transform.rotation = Quaternion.Slerp(startRotation, Quaternion.Euler(finalRotation), t);
                transform.position = Vector3.Lerp(startPosition, finalPosition, t);
                yield return(null);
            }
            OnEndEvent?.Invoke();
        }
Example #5
0
 private void Awake()
 {
     s_instance = this;
     m_player   = FindObjectOfType <CannonBall>();
 }