private void TryToStartSlowmotion() { if (m_slowmotion.CanStartSlowmotion) { UIViewSwitcher.GetUIViewSwitcher().ChangeColorAdjustmentsInOneFrame(true); m_slowmotion.StartSlowmotion(); StartCoroutine(VisualizeSlowmotionTime()); } }
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); }; }
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(); }
private void Awake() { s_instance = this; m_player = FindObjectOfType <CannonBall>(); }