예제 #1
0
    void Beat(double beatNum)
    {
        // Aggregate note types
        char[] p1ActualC = "    ".ToCharArray();
        foreach (NoteType note in p1Notes)
        {
            switch (note)
            {
            case NoteType.left:
                p1ActualC[0] = '<';
                break;

            case NoteType.up:
                p1ActualC[1] = '^';
                break;

            case NoteType.down:
                p1ActualC[2] = 'v';
                break;

            case NoteType.right:
                p1ActualC[3] = '>';
                break;

            default:
                break;
            }
        }
        string p1Actual = new string(p1ActualC);

        // Aggregate note types
        char[] p2ActualC = "    ".ToCharArray();
        foreach (NoteType note in p2Notes)
        {
            switch (note)
            {
            case NoteType.left:
                p2ActualC[0] = '<';
                break;

            case NoteType.up:
                p2ActualC[1] = '^';
                break;

            case NoteType.down:
                p2ActualC[2] = 'v';
                break;

            case NoteType.right:
                p2ActualC[3] = '>';
                break;

            default:
                break;
            }
        }
        string p2Actual = new string(p2ActualC);

        string p1Attempted = BeatInput.CommandToArrows(p1Command);
        string p2Attempted = BeatInput.CommandToArrows(p2Command);

        string p1Message;

        if (p1Actual == "    ")
        {
            p1Message = "   ";
        }
        else if (p1Attempted == p1Actual)
        {
            p1Message = "HIT";
            if (leftPlayer.combo_points < maxSync)
            {
                leftPlayer.combo_points += 1;
            }
        }
        else
        {
            p1Message = "MISS";
        }
        string p2Message;

        if (p2Actual == "    ")
        {
            p2Message = "   ";
        }
        else if (p2Attempted == p2Actual)
        {
            p2Message = "HIT";
            if (rightPlayer.combo_points < maxSync)
            {
                rightPlayer.combo_points += 1;
            }
        }
        else
        {
            p2Message = "MISS";
        }


        // GetComponent<TextMesh>().text = p1Attempted + p2Attempted + "\n" + p1Actual + p2Actual + "\n" + Mathf.Round(1000F*(float)p1Offset).ToString() + " " + Mathf.Round(1000F * (float)p2Offset).ToString();
        GetComponent <TextMesh>().text = p1Message + "   " + p2Message + "\n" + leftPlayer.combo_points + "    " + rightPlayer.combo_points;
        GetComponent <TextMesh>().text.Replace("\n", "\\n");

        leftPlayer.DetermineAction(p1Command);
        rightPlayer.DetermineAction(p2Command);


        p1Command = BeatInput.Command.None;
        p2Command = BeatInput.Command.None;
        p1Notes.Clear();
        p2Notes.Clear();
    }
 void Start()
 {
     myBeatInput = GetComponent <BeatInput>();
 }