public void GenerateNoteObjectsFromJson(TextAsset songJson)
    {
        JsonDecoder.NoteData[] noteDatas;

        JsonDecoder jDecoder = GetComponent <JsonDecoder>();

        if (jDecoder == null)
        {
            jDecoder = gameObject.AddComponent <JsonDecoder>();
        }

        noteDatas = jDecoder.GetNoteDataFromJson(songJson);

        noteObjects = new NoteObject[noteDatas.Length];

        ActiveNoteObjects = new List <NoteObject>();

        for (int i = 0; i < noteDatas.Length; i++)
        {
            noteObjects[i].noteData = noteDatas[i];
        }
    }
Пример #2
0
    //public JsonDecoder.NoteData[] noteDatas;

    public void GenerateNoteObjectsFromJson(TextAsset songJson)
    {
        JsonDecoder.NoteData[] noteDatas;

        JsonDecoder jDecoder = GetComponent <JsonDecoder>();

        if (jDecoder == null)
        {
            jDecoder = gameObject.AddComponent <JsonDecoder>();
        }

        noteDatas = jDecoder.GetNoteDataFromJson(songJson);

        noteObjects = new NoteObject[noteDatas.Length];

        ActiveNoteObjects = new List <NoteObject>();

        for (int i = 0; i < noteDatas.Length; i++)
        {
            noteObjects[i] = new NoteObject();

            noteObjects[i].time = noteDatas[i].time;

            noteObjects[i].pad = noteDatas[i].pad;

            noteObjects[i].StartTime = noteObjects[i].time + HitTargetTimeOffsetMS - NoteAppearTimeMS;

            noteObjects[i].TargetTime = noteObjects[i].time + HitTargetTimeOffsetMS;

            noteObjects[i].ExpireTime = noteObjects[i].time + HitTargetTimeOffsetMS + HitThresholdMS;

            noteObjects[i].CanHitTime = noteObjects[i].time + HitTargetTimeOffsetMS - HitThresholdMS;
        }

        NotesGenerated();
    }