Skip to content

Adicionei esse codigo ao button receiver para permitir o click com o mouse #1

Description

@GAMAURER

private void Update()
{

    //PointerInputEventData pointerInputEventData = FocusManager.Instance.GetSpecificPointerEventData(pointingSource);
    //GameObject obj = pointerInputEventData.selectedObject;


    //if (Input.GetButtonDown("Fire1"))
      
    if (Input.GetMouseButtonDown(0))
    {
        Debug.Log("click");

        GameObject obj;
        RaycastHit hitInfo;
        if (Physics.Raycast(
                Camera.main.transform.position,
                Camera.main.transform.forward,
                out hitInfo,
                20.0f,
                Physics.DefaultRaycastLayers))
        {
        
            obj = hitInfo.collider.gameObject;
            obj = obj.transform.parent.gameObject;
            // If the Raycast has succeeded and hit a hologram
            // hitInfo's point represents the position being gazed at
            // hitInfo's collider GameObject represents the hologram being gazed at

            txt.text = obj.name + " : InputDown";
            Debug.Log(obj.transform.parent.name);
            if (obj.layer == 9)
            {
                // is and object -> shoudld check if correct
                if (obj.name == objectToFindName)
                {
                    Correct();
                }
                else
                {
                    Wrong();
                }
            }
            else if (obj.layer == 10)
            {
                // object from scene selector menu
                GoToNextScene();
            }
            else
            {
                // is a menu option -> should show other menu

                testManager.GetComponent<FileLog>().Click(3);

                //hide curent menu
                currentMenu.SetActive(false);

                //show next menu
                foreach (GameObject m in menus)
                {
                    if (m.name == obj.name)
                    {
                        m.SetActive(true);
                        currentMenu = m;
                        break;
                    }
                }

            }
        }
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions