//ToDo: EventSystem private void Start() { Setup(); if (!currentSong) { StartCoroutine(SpawnRandom()); } else { //change timing of song, add to serializable object itself? if (currentSong.changeTiming.change) { for (int i = (int)currentSong.changeTiming.indexRange.x; i < currentSong.changeTiming.indexRange.y && i < currentSong.notesToSpawn.Count; i++) { NoteSpawn replace = new NoteSpawn(); replace = currentSong.notesToSpawn[i]; replace.timingInSeconds += currentSong.changeTiming.changeBySec; currentSong.notesToSpawn[i] = replace; } currentSong.changeTiming.change = false; } StartPlayingCurrentSong(); } }
private void SetupNotes() { notesSpawns = new NoteSpawn[song.notes.Length]; for (int i = 0; i < song.notes.Length; ++i) { notesSpawns[i] = new NoteSpawn(song.notes[i].timeStamp - noteApproachTime); } }
public Note SpawnNote(NoteSpawn noteInfo) { timeSInceLastSpawn = 0; GameObject obj; switch (noteInfo.typeToSpawn) { case NoteType.TAP: obj = Instantiate(notePrefab, new Vector3(noteSpawnX, beltYPos[noteInfo.lineToSpawnOn], 0), Quaternion.identity); break; case NoteType.HOLD: obj = Instantiate(holdNotePrefab, new Vector3(noteSpawnX, beltYPos[noteInfo.lineToSpawnOn], 0), Quaternion.identity); break; case NoteType.AVOID: obj = Instantiate(avoidNotePrefab, new Vector3(noteSpawnX, beltYPos[noteInfo.lineToSpawnOn], 0), Quaternion.identity); break; default: obj = Instantiate(notePrefab, new Vector3(noteSpawnX, beltYPos[noteInfo.lineToSpawnOn], 0), Quaternion.identity); Debug.LogWarning("something went wrong in spawn switch"); break; } Note toQueue = obj.GetComponent <Note>(); beltLines[noteInfo.lineToSpawnOn].notes.Enqueue(toQueue); toQueue.line = noteInfo.lineToSpawnOn; toQueue.lengthInHoldTime = noteInfo.noteLength; if (noteInfo.typeToSpawn != NoteType.HOLD) { if (noteInfo.overrideSprite) { toQueue.SetSprite(noteInfo.overrideSprite); } else { //ToDo: move this into note script if (GameManager.instance && GameManager.instance.currentCharacter.specialProductSprites.Length > 0 && Random.Range(0, 10) >= 9) { int randomSpriteIndex = Random.Range(0, GameManager.instance.currentCharacter.specialProductSprites.Length); toQueue.SetSprite(GameManager.instance.currentCharacter.specialProductSprites[randomSpriteIndex]); } else { toQueue.SetRandomSprite(); } } } return(toQueue); }
private void Awake() { instance = this; noteSpawn = this.GetComponentInChildren <NoteSpawn>(); noteJudgement = this.GetComponentInChildren <NoteJudgement>(); float widthRatio = Screen.width / 1920f; dragMinDistance = 200f * widthRatio; dragMinDelta = 6f * widthRatio; }
void ReplaceLastNoteWithHold(int beltIndex, float timer) { for (int i = recordedNotes.Count - 1; i >= 0; i--) { if (recordedNotes[i].lineToSpawnOn == beltIndex) { NoteSpawn holdReplacement = new NoteSpawn(NoteType.HOLD, beltIndex, recordedNotes[i].timingInSeconds, timer); recordedNotes[i] = holdReplacement; return; } } }