Beispiel #1
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, mask);

            Dialog dialog = null;

            if (hit.collider != null)
            {
                dialog = hit.collider.GetComponent <Dialog>();
            }
            else
            {
                return;
            }

            if (dialog != null)
            {
                print(dialog.name);
                dialog.AllMessage();

                Hide(dialog);
                Open();
            }
        }
    }