// Use this for initialization public void Initialize(int totalBeats, float beatsThatFit) { zPerBeat = (MAX_Z - MIN_Z) / totalBeats; changes = new List <NoteDetails>(); littleNoteMap = new Dictionary <NoteDetails, GameObject>(); currentWidthOfMinimap = 1; Debug.LogWarning("Minimap width - " + currentWidthOfMinimap); this.totalBeats = totalBeats; notes = BeatMap.GetAllNotes(true); GameObject container = new GameObject("NoteContainer"); container.transform.SetParent(transform); container.transform.localPosition = Vector3.zero; foreach (NoteDetails note in notes) { GameObject smallNote; if (note.color == Note.NoteColor.LEFT) { smallNote = Instantiate(noteRed); } else { smallNote = Instantiate(noteBlue); } smallNote.transform.SetParent(container.transform); smallNote.transform.localPosition = Vector3.zero; Vector3 newPosition = new Vector3( note.gridPosition.x / NoteSpacingXY, note.gridPosition.y / NoteSpacingXY, MIN_Z + note.timeToSpawn * zPerBeat); smallNote.transform.localPosition = newPosition; if (!showNotes) { smallNote.GetComponent <MeshRenderer>().enabled = false; } littleNoteMap.Add(note, smallNote); } GameObject barContainer = new GameObject("BarContainer"); barContainer.transform.SetParent(transform); barContainer.transform.position = transform.position; float startAtZ = barContainer.transform.position.z; currentTimeBar = Instantiate(miniBarPrefab).GetComponent <BeatBar>(); currentTimeBar.name = "TimeBar"; currentTimeBar.transform.SetParent(null); currentTimeBar.transform.position = new Vector3(1.306f, 1.47f, MAX_Z + .0447f); currentTimeBar.SetBeatNumber(0); BeatBar spawnPointBar = Instantiate(miniBarNoDisplayPrefab, currentTimeBar.transform) .GetComponent <BeatBar>(); float totalZ = beatsThatFit * zPerBeat; spawnPointBar.transform.localScale = Vector3.one; spawnPointBar.transform.localPosition = Vector3.zero; Vector3 newSpawnBarPosition = spawnPointBar.transform.position; newSpawnBarPosition.z += totalZ; spawnPointBar.transform.position = newSpawnBarPosition; SetZBasedOnBeat(BeatMap.GetCurrentBeat()); GameObject miniMapContainer = new GameObject("Minimap Container"); transform.SetParent(miniMapContainer.transform); initialized = true; }