예제 #1
0
    private void Update()
    {
        playerUI.ChangeReticle(Color.black);
        RaycastHit hitInfo;

        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hitInfo, 30f))
        {
            Interactable interactable = hitInfo.collider.GetComponent <Interactable>();
            if (interactable != null)
            {
                playerUI.ChangeReticle(Color.green);
                if (Input.GetMouseButtonDown(0))
                {
                    interactable.Interact(this);
                }
            }
        }
    }