Exemple #1
0
    //长按色块的判定
    private void LongNoteCtr()
    {
        foreach (Transform longNote in longNotes)
        {
            NoteCtr noteCtr = longNote.gameObject.GetComponent <NoteCtr>();
            if (!noteCtr.isPass)
            {
                if ((gameObject.transform.position.z + (0.5f * longNote.localScale.y * 10) - longNote.position.z) > 0)
                {
                    //进入判定范围
                    //  print("进入长条判定范围");
                    if (isDown[noteCtr.track - 1] == true)
                    {
                        //正确操作
                        noteCtr.isRight = true;
                        comboincrement += 5 * Time.deltaTime;
                        if (comboincrement >= 1)
                        {
                            effectsSixMode[6].GetComponent <ParticleSystem>().Play();
                            combo++;
                            if (combo < 10)
                            {
                                score += 20;
                            }
                            else if (combo < 100)
                            {
                                score += 35;
                            }
                            else if (combo >= 100)
                            {
                                score += 50;
                            }
                            uiShow.comboText.text = combo.ToString();
                            uiShow.scoreText.text = "Score " + score.ToString();
                            TweenComboImage();
                            TweenDetermineImage(uiShow.determineImage, 0);
                            comboincrement = 0;
                            perfectCount++;
                        }

                        //播放特效
                        //TODO
                    }
                }
            }
        }
    }
Exemple #2
0
    public void NoteIsPassCtr()
    {
        if (notes.Count > 0)
        {
            for (int i = 0; i < notes.Count; i++)
            {
                NoteCtr noteCtr = notes[i].GetComponent <NoteCtr>();
                if (noteCtr.isPass == false)
                {
                    if (gameObject.transform.position.z - notes[i].position.z > 3.0 * speed / 10)
                    {
                        if (noteCtr.isRight == false)
                        {
                            //错过操作
                            //    print("miss");
                            missCount++;
                            DOTween.KillAll();
                            TweenDetermineImage(uiShow.determineImage, 3);
                            uiShow.determineImage.sprite = uiShow.prefabDetermineImages[3];
                            if (combo > maxCombo)
                            {
                                maxCombo = combo;
                            }
                            combo = 0;
                            uiShow.comboImage.gameObject.SetActive(false);
                            uiShow.comboText.text = "";
                            //          noteCtr.isPass = true;
                        }
                        GameObject note = notes[i].gameObject;
                        notes.Remove(notes[i]);
                        note.SetActive(false);
                        //  noteCtr.isPass = true;
                    }
                }
            }
        }

        for (int i = 0; i < longNotes.Count; i++)
        {
            NoteCtr noteCtr = longNotes[i].GetComponent <NoteCtr>();
            if (noteCtr.isPass == false)
            {
                if (gameObject.transform.position.z - 0.5f * longNotes[i].localScale.y * 10 - longNotes[i].position.z > 0)
                {
                    if (noteCtr.isRight == false)
                    {
                        //错过操作

                        missCount++;
                        DOTween.KillAll();   //清楚其他的tween
                        TweenDetermineImage(uiShow.determineImage, 3);
                        uiShow.determineImage.sprite = uiShow.prefabDetermineImages[3];
                        if (combo > maxCombo)
                        {
                            maxCombo = combo;
                        }
                        combo = 0;
                        uiShow.comboImage.gameObject.SetActive(false);
                        uiShow.comboText.text = "";
                        //     noteCtr.isPass = true;
                    }
                    GameObject note = longNotes[i].gameObject;
                    longNotes.Remove(longNotes[i]);
                    note.SetActive(false);
                    //   noteCtr.isPass = true;
                }
            }
        }
    }
Exemple #3
0
    public void OnNoteButtonClick(int trackIndex)
    {
        if (GameCtr.gameMode == 6)
        {
            effectsSixMode[trackIndex - 1].GetComponent <ParticleSystem>().Play();
        }
        else if (GameCtr.gameMode == 4)
        {
            effectsFourMode[trackIndex - 1].GetComponent <ParticleSystem>().Play();
        }
        if (!isJustPressd[trackIndex - 1])
        {
            for (int i = 0; i < notes.Count; i++)
            {
                NoteCtr noteCtr = notes[i].gameObject.GetComponent <NoteCtr>();
                if (!noteCtr.isPass)
                {
                    if (!noteCtr.isRight)
                    {
                        if (Mathf.Abs(notes[i].position.z - gameObject.transform.position.z) < (3.0f * speed / 10.0f) && trackIndex == noteCtr.track)
                        {
                            //点击正确
                            noteCtr.isRight = true;                                                                                   //该色块点击正确
                            noteCtr.isPass  = true;                                                                                   //该色块判定结束
                            int distance = (int)((Math.Abs(transform.position.z - notes[i].transform.position.z)) / (speed / 10.0f)); //计算点击正确时距离门的距离,以触发对应的效果

                            switch (distance)
                            {
                            case 0:
                                perfectCount++;
                                score += 36;
                                break;

                            case 1:
                                greatCount++;
                                score += 24;
                                break;

                            case 2:
                                coolCount++;
                                score += 12;
                                break;

                            default:
                                break;
                            }
                            combo++;
                            if (combo < 10)
                            {
                                score += 20;
                            }
                            else if (combo < 100)
                            {
                                score += 35;
                            }
                            else if (combo >= 100)
                            {
                                score += 50;
                            }
                            TweenComboImage();
                            TweenDetermineImage(uiShow.determineImage, distance);
                            uiShow.comboText.text = combo.ToString();
                            uiShow.scoreText.text = "Score " + score.ToString();
                            //播放特效
                            //TODO
                            effectsSixMode[6 + distance].GetComponent <ParticleSystem>().Play();
                            //notes[i].gameObject.SetActive(false);
                            GameObject note = notes[i].gameObject;
                            notes.Remove(notes[i]);
                            note.SetActive(false);
                            break;
                        }
                    }
                }
            }
        }
        isJustPressd[trackIndex - 1] = true;
        IsJustPressdCtr(trackIndex - 1);
    }