示例#1
0
    IEnumerator AwaitMakeNote(Note note)
    {
        GameManager.NoteType noteType = note.noteType;
        int order = note.order;

        yield return(new WaitForSeconds(startingPoint + (order * beatInterval)));

        MakeNote(note);
    }
示例#2
0
    void Start()
    {
        noteObjectPooler = gameObject.GetComponent <ObjectPooler>();

        //리소스에서 비트 텍스트 파일을 불러옵니다.
        TextAsset    textAsset = Resources.Load <TextAsset>("Musics/" + GameManager.instance.musicName);
        StringReader reader    = new StringReader(textAsset.text);

        Debug.Log("Musics/" + GameManager.instance.musicName);
        musicTitle  = reader.ReadLine();
        musicArtist = reader.ReadLine();

        string[] beatInformation = reader.ReadLine().Split(' ');
        Debug.Log(beatInformation);
        bpm           = Convert.ToInt32(beatInformation[0]);
        divider       = Convert.ToInt32(beatInformation[1]);
        startingPoint = (float)Convert.ToDouble(beatInformation[2]);

        // bpm 1분당 비트 개수
        // divider는 기본으로 60. // 즉 1초마다 떨어 비트 개수
        // 지금 divider 는 30. // 즉 1초마다 떨어지는 비트 수가 많아짐
        beatCount = (float)bpm / divider; // 160/30
        // 비트가 떨어지는 간격 시간
        beatInterval = 1 / beatCount;     // 30/160

        // read 각 비트들이 떨어지는 위치 및 시간 정보
        string line;

        while ((line = reader.ReadLine()) != null)
        {
            string[]             noteInfo = line.Split(' ');
            GameManager.NoteType noteType = (GameManager.NoteType)Convert.ToInt32(noteInfo[0]);
            int order = Convert.ToInt32(noteInfo[1]);

            notes.Add(new Note(noteType, order));
        }

        // 모든 노트를 정해진 시간에 출발하도록 설정
        for (int i = 0; i < notes.Count; ++i)
        {
            StartCoroutine(AwaitMakeNote(notes[i]));
        }
    }
示例#3
0
    public GameObject GetObject(GameManager.NoteType noteType)
    {
        int noteTypeInteger = (int)noteType;

        foreach (GameObject obj in poolsOfNotes[noteTypeInteger])
        {
            if (obj.activeInHierarchy == false)
            {
                return(obj);
            }
        }

        if (more)
        {
            GameObject obj = Instantiate(NotePrefabs[noteTypeInteger]);
            poolsOfNotes[noteTypeInteger].Add(obj);

            return(obj);
        }

        return(null);
    }
示例#4
0
 public Note(GameManager.NoteType noteType, int order)
 {
     this.noteType = noteType;
     this.order    = order;
 }