private void OnTriggerEnter2D(Collider2D collision) { // If we touch Yoshi if (collision.gameObject.GetComponent <Yoshi>() != null) { // Show message box MessageBoxScript mbs = FindObjectOfType <MessageBoxScript>(); mbs.SetText(Text); mbs.SetTitle(Title); mbs.SetButton(Button); mbs.SetInfo(); switch (Icon) { case InfoIcon.WARNING: mbs.SetWarning(); break; case InfoIcon.INFO: mbs.SetInfo(); break; case InfoIcon.ERROR: mbs.SetError(); break; } if (BigBox) { mbs.SetBigBox(); } else { mbs.SetSmallBox(); } mbs.ShowMessageBox(); // Destroy self Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D collision) { // If it's Yoshi if (collision.GetComponent <Yoshi>() != null) { // Show message box MessageBoxScript mbs = FindObjectOfType <MessageBoxScript>(); mbs.SetText("All files in the recycle bin will now be deleted."); mbs.SetTitle("Recycle Bin"); mbs.SetButton("OK"); mbs.SetInfo(); mbs.SetSmallBox(); mbs.ShowMessageBox(); // Sets up close event mbs.OnMessageBoxClose = () => { // Goes to next scene SceneManager.LoadScene("YoshiWorry2"); }; } }