public void UpdateEnemy(float progressTimer) { // NOTEの時間 は 譜面の時間 + NOTE到達時間 float noteTimer = progressTimer + this.noteArriveTime; for (; this.enemyProgressIndex < RhythmGameDataManager.musicScoreRecordDataList.dataList.Count; this.enemyProgressIndex++) { MasterMusicScoreRecordData data = RhythmGameDataManager.musicScoreRecordDataList.dataList[this.enemyProgressIndex]; bool isExistNote = false; bool isCreateNote = false; if (data.drum > 0) { isExistNote = true; if (data.time <= noteTimer) { isCreateNote = true; createNote(data, NoteSoundType.drum); } } if (data.snare > 0) { isExistNote = true; if (data.time <= noteTimer) { isCreateNote = true; createNote(data, NoteSoundType.snare); } } if (data.hihat > 0) { isExistNote = true; if (data.time <= noteTimer) { isCreateNote = true; createNote(data, NoteSoundType.hihat); } } if (isCreateNote) { this.enemyProgressIndex++; } if (isExistNote) { break; } } updateNote(); }
private void createNote(MasterMusicScoreRecordData data, NoteSoundType soundType) { NoteObject noteObject = getInactiveNote(); noteObject.Position = data.position; noteObject.SoundType = soundType; int soundIndex = (int)soundType; GameObject posObject = this.noteObjectPositions[soundIndex]; Vector3 pos = noteObject.transform.localPosition; pos.x = posObject.transform.localPosition.x; pos.y = 0; // 初期値 noteObject.transform.localPosition = pos; }
public void Judge(NoteSoundType soundType, MasterMusicScoreRecordData data) { int soundTypeIndex = (int)soundType; foreach (NoteObject note in this.noteObjectList) { if (note.SoundType == soundType) { if (note.Position == data.position) { note.Judge(); break; } } } }
// entry内のデータをわかりやすい形式のデータに変換して返却する public MasterMusicScoreRecordDataList GetDataList() { MasterMusicScoreRecordDataList dataList = new MasterMusicScoreRecordDataList(); List <MasterMusicScoreRecordData> list = new List <MasterMusicScoreRecordData>(); foreach (Dictionary <string, object> dic in this.entry) { MasterMusicScoreRecordData data = new MasterMusicScoreRecordData(); string position = ResponseObjectManager.GetStringFromDictionary(dic, "position"); data.position = uint.Parse(position); string drum = ResponseObjectManager.GetStringFromDictionary(dic, "drum"); if (uint.TryParse(drum, out data.drum) == false) { data.drum = 0; } string snare = ResponseObjectManager.GetStringFromDictionary(dic, "snare"); if (uint.TryParse(snare, out data.snare) == false) { data.snare = 0; } string hihat = ResponseObjectManager.GetStringFromDictionary(dic, "hihat"); if (uint.TryParse(hihat, out data.hihat) == false) { data.hihat = 0; } list.Add(data); } dataList.dataList = list; return(dataList); }
private void setupTutorial() { setInformationText("TUTORIAL準備中"); RhythmGameDataManager.masterStageRecordDataList = new MasterStageRecordDataList(); RhythmGameDataManager.masterStageRecordDataList.dataList = new List <MasterStageRecordData>(); MasterStageRecordData stageRecordData = new MasterStageRecordData(); stageRecordData.bpm = "120"; stageRecordData.stageName = "Introduction"; stageRecordData.version = "1"; RhythmGameDataManager.masterStageRecordDataList.dataList.Add(stageRecordData); this.titleRoot.SetActive(false); this.menuRoot.SetActive(true); // 譜面を読み込み MusicScoreSaveDataDictionary musicScoreSaveDataDictionary = new MusicScoreSaveDataDictionary(); MusicScoreSaveData musicScoreSaveData = new MusicScoreSaveData(); musicScoreSaveData.musicScoreRecordDataList = new MasterMusicScoreRecordDataList(); MasterMusicScoreRecordData musicScoreRecordData = new MasterMusicScoreRecordData(); musicScoreRecordData.drum = 1; musicScoreRecordData.position = 0; musicScoreSaveData.musicScoreRecordDataList.dataList.Add(musicScoreRecordData); musicScoreRecordData = new MasterMusicScoreRecordData(); musicScoreRecordData.drum = 1; musicScoreRecordData.position = 48; musicScoreSaveData.musicScoreRecordDataList.dataList.Add(musicScoreRecordData); musicScoreRecordData = new MasterMusicScoreRecordData(); musicScoreRecordData.drum = 1; musicScoreRecordData.position = 96; musicScoreSaveData.musicScoreRecordDataList.dataList.Add(musicScoreRecordData); musicScoreRecordData = new MasterMusicScoreRecordData(); musicScoreRecordData.drum = 1; musicScoreRecordData.position = 144; musicScoreSaveData.musicScoreRecordDataList.dataList.Add(musicScoreRecordData); if (RhythmGameDataManager.musicScoreDictionary.ContainsKey("Introduction") == false) { RhythmGameDataManager.musicScoreDictionary.Add("Introduction", musicScoreSaveData.musicScoreRecordDataList); } PlayRecordSaveDataDictionary playData = new PlayRecordSaveDataDictionary(); playData.practicePlayRecordSaveDataDictionary = new Dictionary <string, PlayRecordSaveData>(); playData.standardPlayRecordSaveDataDictionary = new Dictionary <string, PlayRecordSaveData>(); for (int i = 0; i < RhythmGameDataManager.masterStageRecordDataList.dataList.Count; i++) { MasterStageRecordData data = RhythmGameDataManager.masterStageRecordDataList.dataList[i]; MusicCell musicCell = Object.Instantiate <MusicCell>(this.musicCellPrefab, this.scrollContent.transform); musicCell.Setup(data.stageName, playData); musicCell.RegisterCallbackPracticeButton(onClickPracticeButton); musicCell.RegisterCallbackStandardButton(onClickStandardButton); } setInformationText("TUTORIAL準備完了"); }
private void enemyTurnProcess() { this.timerText.text = this.enemyTimer.ToString("0.00"); this.noteManager.UpdateEnemy(this.progressTimer); for (; this.musicScoreProgressIndex < RhythmGameDataManager.musicScoreRecordDataList.dataList.Count; this.musicScoreProgressIndex++) { MasterMusicScoreRecordData data = RhythmGameDataManager.musicScoreRecordDataList.dataList[this.musicScoreProgressIndex]; // ノートがあったらbreakする bool isExistNote = false; // ノートがあって、さらにそれについて音を鳴らす場合 bool isPlaySound = false; if (data.drum > 0 || data.snare > 0 || data.hihat > 0) { isExistNote = true; if (data.time <= this.enemyTimer) { isPlaySound = true; } } if (isPlaySound) { this.musicScoreProgressIndex++; if (data.drum > 0) { this.drumObject.OnTouchDown(); playNoteEffect(NoteSoundType.drum); this.noteManager.Judge(NoteSoundType.drum, data); } if (data.snare > 0) { this.snareObject.OnTouchDown(); playNoteEffect(NoteSoundType.snare); this.noteManager.Judge(NoteSoundType.snare, data); } if (data.hihat > 0) { this.hihatObject.OnTouchDown(); playNoteEffect(NoteSoundType.hihat); this.noteManager.Judge(NoteSoundType.hihat, data); } break; } if (isExistNote) { break; } } this.enemyTimer += Time.deltaTime; this.progressTimer += Time.deltaTime; if (this.musicScoreProgressIndex >= RhythmGameDataManager.musicScoreRecordDataList.dataList.Count) { this.timerText.color = new Color(1.0f, 1.0f, 1.0f); this.countDownTimer = 1.25f; changeState(GameState.PlayerReady); } }