void Update() { if (!SaveChanges) { return; } SaveChanges = false; NoteBehaviour note = GetComponent <NoteBehaviour>(); NoteCreator creator = note.transform.parent.GetComponent <NoteCreator>(); if (EditSpeed) { note.Speed = NewSpeed; note.SpawnTime = Mathf.Clamp(note.EndTime - (GameManager.SPAWN_DISTANCE_FROM_ORIGIN / note.Speed), 0.0f, float.MaxValue); } if (EditEndTime) { note.SpawnTime = Mathf.Clamp(NewEndTime - (GameManager.SPAWN_DISTANCE_FROM_ORIGIN / note.Speed), 0.0f, float.MaxValue); note.EndTime = NewEndTime; } if (EditPositionIndex) { creator.PositionsGenerator(); note.StartingPosition = creator.Positions[NewPositionIndex]; note.PositionIndex = NewPositionIndex; } }
void Start() { behaviour = GetComponent <NoteBehaviour>(); // Ensure that the note only appears at its required position rather than wherever it may have been when instantiated. Update(); }
public void SetNoteColor(NoteBehaviour note) { switch (note.Type) { case NoteType.Pink: note.gameObject.GetComponent <Renderer>().material.color = Color.magenta; break; case NoteType.Blue: note.gameObject.GetComponent <Renderer>().material.color = Color.blue; break; case NoteType.Yellow: note.gameObject.GetComponent <Renderer>().material.color = Color.yellow; break; case NoteType.Green: note.gameObject.GetComponent <Renderer>().material.color = Color.green; break; case NoteType.Red: note.gameObject.GetComponent <Renderer>().material.color = Color.red; break; } }
private void Hit(NoteBehaviour note) { HitType type = CalculateHitType(transform, note.transform); Color color; switch (type) { case HitType.Miss: color = Color.grey; break; case HitType.Poor: color = Color.yellow; break; case HitType.Good: color = Color.green; break; case HitType.Perfect: color = Color.magenta; break; default: color = Color.black; break; } points = 50.0f * (int)type * POINTS_MULTIPLIER; scoreManager.AddScore(points); note.Hit(type.ToString(), color); CurrentStreak++; }
public void OpenNote(NoteBehaviour note) { if (note != null) { currentNoteId = note.id; noteHeader.text = note.title; noteBody.text = note.text; } else { currentNoteId = -1; noteHeader.text = ""; noteBody.text = ""; } }
public NoteBehaviour AddNote(string title, string text) { NoteBehaviour newItem = Instantiate(notePrefab, notesParent); newItem.id = currentNotes.Count; newItem.title = title; newItem.titleObject.text = title; newItem.onSelectNoteEvent.AddListener(delegate { OpenNote(newItem.id); }); newItem.OnRemoveNoteEvent.AddListener(delegate { RemoveNote(newItem.id); }); currentNotes.Add(newItem); EditNoteTitle(title, newItem.id); EditNoteText(text, newItem.id); UpdateNoteFieldInteractable(); return(newItem); }
private void InitializeNoteList() { _noteList = new List <NoteBehaviour>(); int i = 0; foreach (NoteType type in _typeList) { NoteBehaviour note = GameObject.Instantiate <NoteBehaviour>(_notePrefab, this.transform); note.Type = type; SetNoteColor(note); note.gameObject.transform.position = new Vector2(i, 0); i++; _noteList.Add(note); Debug.Log("Added note to list. Type : " + type); } }
public void RecycleNote(NoteBehaviour note) { note.gameObject.SetActive(false); note.NoteData = null; recycleList.Enqueue(note); }
void OnEnable() { behaviour = GetComponent <NoteBehaviour>(); Update(); }