private void pictureBoxTrash_Click(object sender, EventArgs e) { for (int i = 0; i < flpNote.Controls.Count; i++) { if (flpNote.Controls[i].BackColor == Color.LightGray) { Trash trash = new Trash(); Note note = NoteController.GetNote(i); trash.ID = TrashController.GetListTrash().Count; trash.description = note.description; trash.dateCreated = note.dateCreated; trash.tags = note.tags; trash.isPinned = note.isPinned; TrashController.AddTrash(trash); NoteController.RemoveNote(note); NoteController.RefreshNote(); flpNote.Controls.Remove(flpNote.Controls[i]); this.richTextBoxDescription.Text = ""; break; } } for (int i = this.flpTags.Controls.Count - 1; i >= 0; i--) { Control c = this.flpTags.Controls[i]; if (c.GetType() != typeof(TextBox)) { this.flpTags.Controls.RemoveAt(i); } } }
private void Explode() { isAlive = false; gameObject.GetComponent <MeshRenderer>().enabled = false; gameObject.GetComponent <Collider>().enabled = false; this.audioSource.clip = explosionClip; this.audioSource.Play(); GameObject explosionInstance = Instantiate(explosion, this.transform.position, this.transform.rotation); explosionInstance.transform.localScale = this.transform.localScale / 2; trashController.AddTrash(GetComponent <MeshFilter> ().mesh, GetComponent <MeshRenderer> ().materials, this.transform.localScale); ScoreCounter.instance.AddScore(this.type); Destroy(this); }