コード例 #1
0
ファイル: ArmUIInteraction.cs プロジェクト: TheIsac/H4ck3D
    public void DetectObjectRaycast()
    {
        RaycastHit hit;
        Ray        ray = new Ray(raycastOrigin.position, raycastOrigin.forward);

        if (Physics.Raycast(ray, out hit, Mathf.Infinity))
        {
            GameObject         hitObject           = hit.collider.gameObject;
            Manipulatable      objectManipulatable = hitObject.GetComponent <Manipulatable>();
            InteractableObject interactableObject  = hitObject.GetComponent <InteractableObject>();
            MonitorMatter      monitorMatter       = currentUIElement.GetComponent <MonitorMatter>();
            MonitorObject      monitorObject       = currentUIElement.GetComponent <MonitorObject>();

            if (objectManipulatable != null && monitorObject != null)
            {
                selectedWorldObject = hit.collider.gameObject;

                monitorObject.currentManipulatable = objectManipulatable;
                monitorObject.UpdateStatement();

                SetUIObjectName(selectedWorldObject.name);
            }
            else if (interactableObject != null && monitorMatter != null)
            {
                interactableObject.UpdateMatter(monitorMatter.matter);
                monitorMatter.gameObject.SetActive(false);
            }
        }
    }