Пример #1
0
    //キー入力
    public bool hit(KeyCode aKey, float aSecond, Note.HitNoteType aType)
    {
        int tLength = (mTriplet) ? 3 : 4;

        for (int i = 0; i < tLength; i++)
        {
            if (mNotes[i] == null)
            {
                continue;                   //音符なし
            }
            float tSecond = MusicScoreData.quarterBeatToMusicTime(mNotes[i].mCorrectQuarterBeat);
            TypeEvaluation.Evaluation tEvaluation = TypeEvaluation.evaluate(aSecond, tSecond);
            if (tEvaluation == TypeEvaluation.Evaluation.miss)
            {
                continue;                                               //タイミングがあってない
            }
            //タイミングOK
            Note.HitResult tHitResult = mNotes[i].hit(aKey, aType);
            if (tHitResult == Note.HitResult.miss)
            {
                continue;                                   //hitしなかった
            }
            //hitしたメッセージ送信
            Subject.sendMessage(new Message("hittedNote", new Arg(new Dictionary <string, object>()
            {
                { "note", mNotes[i] },
                { "evaluation", tEvaluation },
                { "difference", aSecond - tSecond },
                { "hitResult", tHitResult }
            })));
            return(true);
        }
        return(false);
    }
Пример #2
0
        //音符を消した時の演出
        protected void productHit(Note aNote, TypeEvaluation.Evaluation aEvaluation)
        {
            //評価表示オブジェクト生成
            MyBehaviour tBehaviour = MyBehaviour.create <MyBehaviour>();

            tBehaviour.name = "evaluation";
            SpriteRenderer tRenderer = tBehaviour.gameObject.AddComponent <SpriteRenderer>();

            tBehaviour.transform.parent        = parent.mScore.transform;
            tBehaviour.transform.localScale    = new Vector3(1.7f, 1.7f, 1);
            tBehaviour.transform.localPosition = new Vector3(0, 0, 0);
            tBehaviour.transform.Translate(aNote.transform.position - parent.mScore.transform.position);
            tBehaviour.positionZ = -2;
            //sprite設定とアニメーション
            switch (aEvaluation)
            {
            case TypeEvaluation.Evaluation.perfect:
                tRenderer.sprite = Resources.Load <Sprite>("sprites/point/perfect");
                tBehaviour.moveBy(new Vector3(0, 1, 0), 1, () => {
                    tBehaviour.delete();
                });
                break;

            case TypeEvaluation.Evaluation.great:
                tRenderer.sprite = Resources.Load <Sprite>("sprites/point/great");
                tBehaviour.moveBy(new Vector3(0, 0.6f, 0), 1, () => {
                    tBehaviour.delete();
                });
                break;

            case TypeEvaluation.Evaluation.good:
                tRenderer.sprite = Resources.Load <Sprite>("sprites/point/good");
                tBehaviour.moveBy(new Vector3(0, 0.4f, 0), 1, () => {
                    tBehaviour.delete();
                });
                break;

            case TypeEvaluation.Evaluation.bad:
                tRenderer.sprite = Resources.Load <Sprite>("sprites/point/bad");
                tBehaviour.moveBy(new Vector3(0, 0.1f, 0), 1, () => {
                    tBehaviour.delete();
                });
                break;

            case TypeEvaluation.Evaluation.miss:
                tRenderer.sprite = Resources.Load <Sprite>("sprites/point/miss");
                tBehaviour.moveBy(new Vector3(0, -1, 0), 1, () => {
                    tBehaviour.delete();
                });
                break;
            }
        }