private IEnumerator ColorFlash() { if (th.currentColor == "b") { sr.color = GameManager.cWhite; yield return(new WaitForSeconds(0.3f)); sr.color = GameManager.cBlack; yield return(new WaitForSeconds(0.3f)); sr.color = GameManager.cWhite; yield return(new WaitForSeconds(0.3f)); sr.color = GameManager.cBlack; yield return(new WaitForSeconds(0.3f)); th.FlipColor(); } else if (th.currentColor == "w") { sr.color = GameManager.cBlack; yield return(new WaitForSeconds(0.3f)); sr.color = GameManager.cWhite; yield return(new WaitForSeconds(0.3f)); sr.color = GameManager.cBlack; yield return(new WaitForSeconds(0.3f)); sr.color = GameManager.cWhite; yield return(new WaitForSeconds(0.3f)); th.FlipColor(); } }
private IEnumerator Timer() { while (true) { yield return(new WaitForSeconds(changeTime)); th.FlipColor(); } }