Exemplo n.º 1
0
    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);
        }
    }