Ejemplo n.º 1
0
    void ScoreI()//入力すべきタイミングでの判定と点数表示
    {
        if (signal == "1")
        {
            score += 0.05f;

            GameObject.Find("Comment").GetComponent <Text>().text   = "Good";
            GameObject.Find("ScoreText").GetComponent <Text>().text = score.ToString("F0");
            serialcontroller.Write("0");
        }
        else
        {
            if (score > 0)
            {
                score -= 0.05f;
                GameObject.Find("Comment").GetComponent <Text>().text   = "Miss";
                GameObject.Find("ScoreText").GetComponent <Text>().text = score.ToString("F0");
                serialcontroller.Write("1");
            }
            else
            {
                GameObject.Find("Comment").GetComponent <Text>().text   = "Miss";
                GameObject.Find("ScoreText").GetComponent <Text>().text = score.ToString("F0");
                serialcontroller.Write("1");
            }
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (_isPlaying)
        {
            GameObject.Find("Timer").GetComponent <Text>().text = GetMusicTime().ToString("F2");
            CheckNextNotes();

            Debug.Log(serialcontroller.ReadData());

            if (serialcontroller.ReadData() == "1")
            {
                                                    //押し始め判定
                {
                    if (GetMusicTime() - _start[_begin] >= -0.4f && GetMusicTime() - _start[_begin] <= 0.4f)
                    {
                        score += 100f;

                        GameObject.Find("Comment").GetComponent <Text>().text   = "Great";
                        GameObject.Find("ScoreText").GetComponent <Text>().text = score.ToString("F0");
                        Instantiate(great, new Vector3(_posx1[_begin], _posy1[_begin], 0), Quaternion.identity);
                        serialcontroller.Write("0");
                        Great++;

                        _begin++;
                    }
                    else if (GetMusicTime() - _start[_begin] >= -0.3f && GetMusicTime() - _start[_begin] <= 0.3f)
                    {
                        score += 50f;

                        GameObject.Find("Comment").GetComponent <Text>().text   = "Good";
                        GameObject.Find("ScoreText").GetComponent <Text>().text = score.ToString("F0");
                        Instantiate(good, new Vector3(_posx1[_begin], _posy1[_begin], 0), Quaternion.identity);
                        serialcontroller.Write("0");
                        Good++;

                        _begin++;
                    }
                    else if (GetMusicTime() - _start[_begin] >= -0.9f && GetMusicTime() - _start[_begin] <= 0.9f)
                    {
                        score += 10;

                        GameObject.Find("Comment").GetComponent <Text>().text   = "Bad";
                        GameObject.Find("ScoreText").GetComponent <Text>().text = score.ToString("F0");
                        Instantiate(bad, new Vector3(_posx1[_begin], _posy1[_begin], 0), Quaternion.identity);
                        serialcontroller.Write("1");
                        Bad++;

                        _begin++;
                    }
                    else
                    {
                    }
                    _isHold = true;
                }
            }

            if (serialcontroller.ReadData() == "1")
            {
                if (_isHold)
                {
                    if (GetMusicTime() - _end[_release] >= -0.1f && GetMusicTime() - _end[_release] <= 0.1f)
                    {
                        score += 100f;

                        GameObject.Find("Comment").GetComponent <Text>().text   = "Great";
                        GameObject.Find("ScoreText").GetComponent <Text>().text = score.ToString("F0");
                        //パスの終わりにエフェクトを入れたい 保持リストを作っていないので別途読み込み
                        serialcontroller.Write("0");
                        Great++;

                        _release++;
                    }
                    else if (GetMusicTime() - _end[_release] >= -0.15f && GetMusicTime() - _end[_release] <= 0.15f)
                    {
                        score += 50f;

                        GameObject.Find("Comment").GetComponent <Text>().text   = "Good";
                        GameObject.Find("ScoreText").GetComponent <Text>().text = score.ToString("F0");
                        serialcontroller.Write("0");
                        Good++;

                        _release++;
                    }
                    else if (GetMusicTime() - _end[_release] >= -0.6f && GetMusicTime() - _end[_release] <= 0.6f)
                    {
                        GameObject.Find("Comment").GetComponent <Text>().text   = "Bad";
                        GameObject.Find("ScoreText").GetComponent <Text>().text = score.ToString("F0");
                        serialcontroller.Write("1");
                        Bad++;

                        _release++;
                    }
                    else
                    {
                    }
                    _isHold = false;
                }
            }
        }
        //scoreText.text = _score.ToString();
    }