// Update is called once per frame void LateUpdate() { Realtime = Time.timeSinceLevelLoad; if (GameObject.FindGameObjectWithTag("Rep") != null && GameObject.FindGameObjectWithTag("Rep").GetComponent <Image>().fillAmount <= 0f) { Lose(); } if (Song.time >= Song.clip.length) { Win(); } if (Song.time > HitTimes[Index] && Index < HitTimes.Count - 1) { generator.NextNote(); Target = generator.Slimes.Find(Slime => Slime != null && Slime.tag == Notes.Notes[Index].tag); if (Target == null) { return; } PlaySound TargetSlime = Target.GetComponent <PlaySound>(); Index++; Notes.Cursor = Index; TargetSlime.EndTime = HitTimes[Index]; TargetSlime.Duration = HitTimes[Index] - Song.time; TargetSlime.Penalty = Penalty; TargetSlime.StartCoroutine(TargetSlime.Timer()); } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Bullet") { //Sound.Play(); StopAllCoroutines(); Destroy(collision.gameObject); //Sound.mute = false; if (EndTime > -1f) { Note.GetComponent <PlayNote>().Hit(Tag, EndTime); } GetComponent <Animator>().Play(DeathAnimation); Generator.NextNote(); Generator.Slimes.Remove(gameObject); //Destroy(gameObject); //StartCoroutine("Death"); } }