IEnumerator CO_ClickRepeat(float _duration, float _clicksPerSecond) { if (!ShowTween.IsComplete()) { ShowTween.timeScale = 2f; ShowTween.PlayForward(); yield return(ShowTween.WaitForCompletion()); } ShowTween.timeScale = 1; float startTime = Time.time; float clickTime = 0; float clickWait = 1 / _clicksPerSecond; while (Time.time - startTime < _duration) { if (Time.time - clickTime >= clickWait) { clickTime = Time.time; Img.sprite = ClickSprite; TutorialUI.I.Pools.SpawnClicker(this.transform.parent, this.transform.position, true); yield return(new WaitForSeconds(0.1f)); Img.sprite = defSprite; } else { yield return(null); } } Hide(); }
IEnumerator CO_Click() { if (!ShowTween.IsComplete()) { ShowTween.timeScale = 2f; ShowTween.PlayForward(); yield return(ShowTween.WaitForCompletion()); } ShowTween.timeScale = 1; Img.sprite = ClickSprite; TutorialUI.I.Pools.SpawnClicker(this.transform.parent, this.transform.position, true); yield return(new WaitForSeconds(0.1f)); Img.sprite = defSprite; yield return(new WaitForSeconds(0.2f)); Hide(); }