Ejemplo n.º 1
0
    public void OnClick()
    {
        GameObject master     = GameObject.Find("noteMaster");
        NoteMaster noteMaster = master.GetComponent <NoteMaster>();

        noteMaster.GoToTitle();        //noteMaster内のタイトル画面に遷移する処理を呼び出す
        Debug.Log("GoToTitle Finished");
    }
Ejemplo n.º 2
0
    public string noteDataName;    //譜面データの名前


    public void OnClick()                       //このボタンが押されたら
    {
        NoteMaster.noteDataName = noteDataName; //譜面データの名前を選ばれた内容に設定する

        GameObject master     = GameObject.Find("noteMaster");
        NoteMaster noteMaster = master.GetComponent <NoteMaster>();

        noteMaster.GoToGame();        //ゲーム開始画面に遷移する
    }
Ejemplo n.º 3
0
 public void InputJudge(float inputPos)    //入力されたオブジェクト空間でのz軸の位置をもとに判定を行う
 {
     for (int i = 0; i < NoteMaster.musicData.noteList.Count; i++)
     {
         Note    n    = NoteMaster.musicData.noteList[i];
         Vector3 pos  = n.gameObject.transform.position;
         Vector3 size = n.gameObject.transform.localScale;
         if (judgeLine.transform.position.x - getLength < pos.x && pos.x < judgeLine.transform.position.x + getLength) //縦幅
         {
             if (pos.z + (size.z / 2) > inputPos && inputPos > pos.z - (size.z / 2))                                   //タッチした位置がオブジェクトの座標と重なった場合
             {
                 if (n.justTime + NoteMaster.greatJudge > nowTime && nowTime > n.justTime - NoteMaster.greatJudge)     //押した時間がGreatの時間内の場合
                 {
                     NoteMaster.great++;                                                                               //greatの数を1つ増やす
                     NoteMaster.score += 100;                                                                          //得点を100追加
                     noteMaster.JudgeTextRewrite("GREAT");                                                             //画面の表示されている判定をGREATに更新
                     NoteMaster.addRecord(n.noteNum, n.justTime, nowTime, "great");                                    //プレイログを記録するための各ノーツの判定を記録するレコードをリストにひとつ追加
                     n.noteMove.StopMove();                                                                            //オブジェクトの流れを止める
                     n.gameObject.GetComponent <NoteFadeOut>().StartFadeOut();                                         //オブジェクトの消失を開始
                     NoteMaster.musicData.noteList.RemoveAt(i);                                                        //ノーツリストから今回判定されたノートを削除
                     break;
                 }
                 else if (n.justTime + NoteMaster.goodJudge > nowTime && nowTime > n.justTime)                    //押した時間がLateの時間内の場合
                 {
                     NoteMaster.late++;
                     NoteMaster.score += 50;
                     noteMaster.JudgeTextRewrite("LATE");
                     NoteMaster.addRecord(n.noteNum, n.justTime, nowTime, "late");
                     n.noteMove.StopMove();
                     n.gameObject.GetComponent <NoteFadeOut>().StartFadeOut();
                     NoteMaster.musicData.noteList.RemoveAt(i);
                     break;
                 }
                 else if (n.justTime > nowTime && nowTime > n.justTime - NoteMaster.goodJudge)                    //押した時間がFastの時間内の場合
                 {
                     NoteMaster.fast++;
                     NoteMaster.score += 50;
                     noteMaster.JudgeTextRewrite("FAST");
                     NoteMaster.addRecord(n.noteNum, n.justTime, nowTime, "fast");
                     n.noteMove.StopMove();
                     n.gameObject.GetComponent <NoteFadeOut>().StartFadeOut();
                     NoteMaster.musicData.noteList.RemoveAt(i);
                     break;
                 }
             }
         }
         else if (pos.x < judgeLine.transform.position.x - getLength)
         {
             break;
         }
     }
 }
Ejemplo n.º 4
0
 void Awake()
 {
     self = this;
     try
     {
         notePrefab = Instantiate(Resources.Load(bgm.clip.name)) as GameObject;
         noteMax    = notePrefab.transform.childCount;
         serial     = new SerialLib.UnitySerial("/dev/cu.usbmodem1411", 9600, 256);
         serial.ThreadStart();
     }
     catch
     {
         Debug.LogError("error" +
                        "Resourcesに音楽の名前と同名のプレハブを作ってください(日本語NG)");
         UnityEditor.EditorApplication.isPlaying = false;
         return;
     }
 }
Ejemplo n.º 5
0
    public void TouchInputCheck()         //画面タッチ入力を画面上の座標からオブジェクト空間の座標に変換し判定メソッド(InputJudge)を呼び出す
    {
        Touch   touchPos2;                //タッチの入力情報
        Vector3 touchPos3;
        int     count = Input.touchCount; //現在のタッチ入力の数

        if (count > 0)
        {
            for (int i = 0; i < count; i++)
            {
                touchPos2 = Input.GetTouch(i);
                if (touchPos2.phase == TouchPhase.Began)                                            //押されたタイミングなら
                {
                    NoteMaster.addTouchRecord(touchPos2.position.x, touchPos2.position.y, nowTime); //タッチ情報を記録するリストに1行追加
                    touchPos3.x = touchPos2.position.x;                                             //画面のタッチされた位置(2次元)を3次元情報に変換
                    touchPos3.y = touchPos2.position.y;
                    touchPos3.z = 0f;
                    worldPos    = Camera.main.ScreenToWorldPoint(touchPos3 + Camera.main.transform.forward);                 //3次元情報からオブジェクト空間内の位置情報へ
                    InputJudge(worldPos.z);
                }
            }
        }
    }