示例#1
0
    private void UpdateCurrentInteract()
    {
        Ray        ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, interactRange, isInteract))
        {
            currentInteract = hit.collider.GetComponent <IInteract>();
        }
        else
        {
            if (currentInteract != null)
            {
                currentInteract.UnDisplay();
            }
            currentInteract = null;
        }
    }