bool isPressing(int button) { if (button == -1) { return(false); } if (Mathf.Abs(StartRail - EndRail) == 0) { if (TimeComponent.isKeyPressing(StartRail)) { return(true); } } else { for (int i = -1; i <= 1; i++) { if (TimeComponent.isKeyPressing(TimeComponent.GetKeyRail(Range(button + i, 0, 14)))) { return(true); } } } return(false); }
void Update() { if (!MainMusicSelect.flag) { //Sound if (TimeComponent.isKeyPressed(0)) { audioSource.PlayOneShot(audioSource.clip); } if (TimeComponent.isKeyPressed(1)) { audioSource.PlayOneShot(audioSource.clip); } if (TimeComponent.isKeyPressed(2)) { audioSource.PlayOneShot(audioSource.clip); } if (TimeComponent.isKeyPressed(3)) { audioSource.PlayOneShot(audioSource.clip); } if (TimeComponent.isKeyPressed(4)) { audioSource.PlayOneShot(audioSource.clip); } //Effect if (TimeComponent.isKeyPressing(0)) { ButtonOverray[0].SetActive(true); } else { ButtonOverray[0].SetActive(false); } if (TimeComponent.isKeyPressing(1)) { ButtonOverray[1].SetActive(true); } else { ButtonOverray[1].SetActive(false); } if (TimeComponent.isKeyPressing(2)) { ButtonOverray[2].SetActive(true); } else { ButtonOverray[2].SetActive(false); } if (TimeComponent.isKeyPressing(3)) { ButtonOverray[3].SetActive(true); } else { ButtonOverray[3].SetActive(false); } if (TimeComponent.isKeyPressing(4)) { ButtonOverray[4].SetActive(true); } else { ButtonOverray[4].SetActive(false); } } }
void Update() { if (this.gameObject.activeSelf) { transform.localPosition = new Vector3(transform.localPosition.x, GameManager.NoteY, transform.localPosition.z) - (new Vector3(0, 1f, 0) * speed * (float)(TimeComponent.GetCurrentTimePast() - StartTime)); } if (this.transform.position.y < -2.5f) { this.gameObject.SetActive(false); ScoreCalculation.SetNoteJudgement(ScoreCalculation.Judgement.Miss, 1); } if (this.gameObject.activeSelf) { double diff = System.Math.Abs(TimeComponent.GetPressedKeyTime(Rail) - ArrivalTime); if (diff <= ScoreCalculation.DetectionRange.Perfect || (System.Math.Abs(ArrivalTime - TimeComponent.GetCurrentTimePast()) <= ScoreCalculation.DetectionRange.SliderPressed && TimeComponent.isKeyPressing(Rail))) //Perfect { audioSource.PlayOneShot(NotePerfectSE); this.gameObject.SetActive(false); ScoreCalculation.SetNoteJudgement(ScoreCalculation.Judgement.Perfect, 1); AddEffect(ScoreCalculation.Judgement.Perfect); //GameManager.DebugLog(this.gameObject.name + "番のノーツ: Perfect"); } else if (diff <= ScoreCalculation.DetectionRange.Bad && diff > ScoreCalculation.DetectionRange.Good) //Bad { this.gameObject.SetActive(false); ScoreCalculation.SetNoteJudgement(ScoreCalculation.Judgement.Bad, 1); AddEffect(ScoreCalculation.Judgement.Bad); //GameManager.DebugLog(this.gameObject.name + "番のノーツ: Bad"); } else if (diff <= ScoreCalculation.DetectionRange.Good && diff > ScoreCalculation.DetectionRange.Great) //Good { audioSource.PlayOneShot(NoteGoodSE); this.gameObject.SetActive(false); ScoreCalculation.SetNoteJudgement(ScoreCalculation.Judgement.Good, 1); AddEffect(ScoreCalculation.Judgement.Good); //GameManager.DebugLog(this.gameObject.name + "番のノーツ: Good"); } else if (diff <= ScoreCalculation.DetectionRange.Great && diff > ScoreCalculation.DetectionRange.Perfect) //Great { audioSource.PlayOneShot(NoteGreatSE); this.gameObject.SetActive(false); ScoreCalculation.SetNoteJudgement(ScoreCalculation.Judgement.Great, 1); AddEffect(ScoreCalculation.Judgement.Great); //GameManager.DebugLog(this.gameObject.name + "番のノーツ: Great"); } } }