void LateUpdate() { if (keys.resetGame) { score.text = "0"; } animator.ResetTrigger("Key1"); animator.ResetTrigger("Key2"); animator.ResetTrigger("Key3"); animator.ResetTrigger("Key4"); if (player1) { for (int i = 0; i < keys._GC.Count; i++) { if (keyValidCounter <= 1) { if (Input.GetKeyDown(KeyCode.W) && keys._GC[i].GetComponent <MoveLetters>().objects == "w" && detect.CheckInBoundary(keys._GC[i].transform.position)) { detect.CheckScore(keys._GC[i].transform.position); Destroy(keys._GC[i]); animator.SetTrigger("Key1"); keys._GC.Remove(keys._GC[i]); score.text = detect._score.ToString(); break; } if (Input.GetKeyDown(KeyCode.A) && keys._GC[i].GetComponent <MoveLetters>().objects == "a" && detect.CheckInBoundary(keys._GC[i].transform.position)) { detect.CheckScore(keys._GC[i].transform.position); Destroy(keys._GC[i]); animator.SetTrigger("Key2"); keys._GC.Remove(keys._GC[i]); score.text = detect._score.ToString(); break; } if (Input.GetKeyDown(KeyCode.S) && keys._GC[i].GetComponent <MoveLetters>().objects == "s" && detect.CheckInBoundary(keys._GC[i].transform.position)) { detect.CheckScore(keys._GC[i].transform.position); Destroy(keys._GC[i]); animator.SetTrigger("Key3"); keys._GC.Remove(keys._GC[i]); score.text = detect._score.ToString(); break; } if (Input.GetKeyDown(KeyCode.D) && keys._GC[i].GetComponent <MoveLetters>().objects == "d" && detect.CheckInBoundary(keys._GC[i].transform.position)) { detect.CheckScore(keys._GC[i].transform.position); Destroy(keys._GC[i]); animator.SetTrigger("Key4"); keys._GC.Remove(keys._GC[i]); score.text = detect._score.ToString(); break; } else if (keys._GC[i].transform.position.y <= destroyPoint.transform.position.y) { detect.StreakCancel(); Destroy(keys._GC[i]); keys._GC.Remove(keys._GC[i]); animator.ResetTrigger("Streak"); score.text = detect._score.ToString(); break; } } else { detect.StreakCancel(); Destroy(keys._GC[i]); keys._GC.Remove(keys._GC[i]); animator.ResetTrigger("Streak"); break; } } } else { for (int i = 0; i < keys._AC.Count; i++) { if (keyValidCounter <= 1) { if (Input.GetKeyDown(KeyCode.UpArrow) && keys._AC[i].GetComponent <MoveLetters>().objects == "up" && detect.CheckInBoundary(keys._AC[i].transform.position)) { detect.CheckScore(keys._AC[i].transform.position); Destroy(keys._AC[i]); animator.SetTrigger("Key1"); keys._AC.Remove(keys._AC[i]); score.text = detect._score.ToString(); break; } if (Input.GetKeyDown(KeyCode.LeftArrow) && keys._AC[i].GetComponent <MoveLetters>().objects == "left" && detect.CheckInBoundary(keys._AC[i].transform.position)) { detect.CheckScore(keys._AC[i].transform.position); Destroy(keys._AC[i]); animator.SetTrigger("Key2"); keys._AC.Remove(keys._AC[i]); score.text = detect._score.ToString(); break; } if (Input.GetKeyDown(KeyCode.DownArrow) && keys._AC[i].GetComponent <MoveLetters>().objects == "down" && detect.CheckInBoundary(keys._AC[i].transform.position)) { detect.CheckScore(keys._AC[i].transform.position); Destroy(keys._AC[i]); animator.SetTrigger("Key3"); keys._AC.Remove(keys._AC[i]); score.text = detect._score.ToString(); break; } if (Input.GetKeyDown(KeyCode.RightArrow) && keys._AC[i].GetComponent <MoveLetters>().objects == "right" && detect.CheckInBoundary(keys._AC[i].transform.position)) { detect.CheckScore(keys._AC[i].transform.position); Destroy(keys._AC[i]); animator.SetTrigger("Key4"); keys._AC.Remove(keys._AC[i]); score.text = detect._score.ToString(); break; } else if (keys._AC[i].transform.position.y <= destroyPoint.transform.position.y) { detect.StreakCancel(); Destroy(keys._AC[i]); keys._AC.Remove(keys._AC[i]); score.text = detect._score.ToString(); animator.ResetTrigger("Streak"); break; } } else { detect.StreakCancel(); Destroy(keys._AC[i]); keys._AC.Remove(keys._AC[i]); animator.ResetTrigger("Streak"); break; } } } }