コード例 #1
0
ファイル: Player.cs プロジェクト: jiDOK/minimal-interaction
    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);
                }
            }
        }
    }