private IEnumerator PlayCoroutine(List <PlayerInputs> inputs) { _isPlaying = true; for (int i = 0; i < inputs.Count; i++) { yield return(new WaitForSeconds(0.5f)); PlayerInputs inp = inputs[i]; if (inp == PlayerInputs.Left) { PlayerTransform.x--; audioSource.Stop(); audioSource.clip = translateClip; audioSource.Play(); } else if (inp == PlayerInputs.Right) { PlayerTransform.x++; audioSource.Stop(); audioSource.clip = translateClip; audioSource.Play(); } else if (inp == PlayerInputs.Up) { PlayerTransform.y++; audioSource.Stop(); audioSource.clip = translate2Clip; audioSource.Play(); } else if (inp == PlayerInputs.Down) { PlayerTransform.y--; audioSource.Stop(); audioSource.clip = translate2Clip; audioSource.Play(); } else if (inp == PlayerInputs.CW) { PlayerTransform.rotation--; audioSource.Stop(); audioSource.clip = rotateRightClip; audioSource.Play(); } else if (inp == PlayerInputs.CounterCW) { PlayerTransform.rotation++; audioSource.Stop(); audioSource.clip = rotateLeftClip; audioSource.Play(); } else if (inp == PlayerInputs.ScaleUp) { PlayerTransform.scale++; audioSource.Stop(); audioSource.clip = scaleUpClip; audioSource.Play(); } else if (inp == PlayerInputs.ScaleDown) { PlayerTransform.scale--; audioSource.Stop(); audioSource.clip = scaleDownClip; audioSource.Play(); } PlayerTransform.x = Mathf.Clamp(PlayerTransform.x, 0, Screen.width / 100); PlayerTransform.y = Mathf.Clamp(PlayerTransform.y, 0, Screen.height / 100); PlayerTransform.scale = Mathf.Clamp(PlayerTransform.scale, 1, 7); PlayerTransform.rotation += 8; PlayerTransform.rotation %= 8; StartCoroutine(LerpCoroutine(PlayerImage.rectTransform, PlayerTransform)); MyInput.PaintAsDone(i, CurrentLevel.spriteColor); } if (IsTransformsEqual(PlayerTransform, TargetTransform)) { CukText.transform.position = TargetImage.gameObject.transform.position; CukText.text = "CUK"; yield return(new WaitForSeconds(0.5f)); CukText.text = ""; if (CurrentLevelId + 1 == levels.Length) { ChangeState(GameState.Win); audioSource.Stop(); audioSource.clip = winClip; audioSource.Play(); } else { audioSource.Stop(); audioSource.clip = cukClip; audioSource.Play(); yield return(new WaitForSeconds(0.2f)); ChangeState(GameState.Transition); } } else { ChangeState(GameState.Lose); audioSource.Stop(); audioSource.clip = loseClip; audioSource.Play(); } _isPlaying = false; }