//Add a new Track to the Song public void AddTrack() { Track t = new Track(SColor.random); _curSong.AddTrack(t); SpawnTrack(t); }
//Add a new track void SpawnTrack(Track t) { float yPos = -padding; yPos -= (_tracks.Count == 0)? 0 : (_tracks[0].image.rectTransform.rect.height + padding)*_tracks.Count; Transform track; Utils.CreateUIImage(trackPrefab, new Vector2(195, yPos), trackScrollView, out track); _tracks.Add(track.GetComponent<UITrackManager>()); _tracks[_tracks.Count - 1].Set(t); trackScrollView.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, ((_tracks[0].image.rectTransform.rect.height + padding) * _tracks.Count) + padding); }
public void RemoveTrack(Track track) { tracks.Remove(track); trackCount = tracks.Count; }
public void AddTrack(Track track) { tracks.Add(track); trackCount = tracks.Count; }
//Set the inital values of the Track public void Set(Track track) { instance = gameObject; _left = _beatParent.position.x; _image = instance.GetComponent<Image>(); this.track = track; _image.color = track.color; trackName.text = track.name; RenderBeats(); Transform beat; Utils.CreateUIImage(beatPrefab, Vector2.zero, _beatParent, out beat); _prevBeat = beat.GetComponent<UIBeatManager>(); _prevBeat.Set(new Beat(0f)); beat.gameObject.SetActive(false); }