GameObject SpawnOne(GhostNote note, Vector2 startPos, Vector2 boostPos, int measureNum) { float spawnTime = (measureNum * 4 + note.beat - 1 - 4.75f) * oneBeat; GameObject go = Instantiate(ghost, transform); go.GetComponent <GhostMover>().SetVariables(spawnTime, startPos, boostPos, Time.time); return(go); }
private void OnEarlySongNote(List<int> noteNumbers, List<float> noteTimes) { if (songController.playMode == PlayMode.Stepped) { return; } for (int i = 0; i < noteNumbers.Count; i++) { if (noteNumbers[i] < 0 || noteNumbers[i] >= keys.Count) { continue; } Vector3 start = keys[noteNumbers[i]].transform.position; GhostNote ghostNote = Instantiate(ghostNotePrefab, start, Quaternion.identity).GetComponent<GhostNote>(); // Set its start position ghostNote.startPos = ghostNote.transform.position; // Set its end position ghostNote.endPos = ghostNote.startPos + travelOffset; ghostNote.duration = songController.delay / songController.speed; StartCoroutine(ghostNote.MoveNote()); } }