Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            currCamera = cameraManage.getCurrCamera();
            RaycastHit hit;
            Ray        camRay = currCamera.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(camRay, out hit, Mathf.Infinity, pickUp))
            {
                Debug.Log("test");
                if (playerAI.addItem(hit.collider.gameObject))
                {
                    hit.collider.gameObject.SetActive(false);
                }

                Debug.Log(hit.transform.name);
            }
            else if (Physics.Raycast(camRay, out hit, Mathf.Infinity, NPCMask))
            {
                npc = hit.transform.gameObject;
                NPCManager.singleton.activeNPC = npc;
                Debug.Log(hit.transform.name);
            }
            Debug.DrawRay(camRay.origin, camRay.direction * 100.0f, Color.green);
        }
    }