コード例 #1
0
    private void FixedUpdate()
    {
        Ray ray = new Ray(headTransform.position + headTransform.up * upOffset,
                          headTransform.forward);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, range, raycastLayerMask) &&
            hit.collider.GetComponent <RaycastReceiver>() != null &&
            !(hit.collider.GetComponent <MeshRenderer>() != null && !hit.collider.GetComponent <MeshRenderer>().isVisible)
            )
        {
            RaycastReceiver _currTarget = hit.collider.GetComponent <RaycastReceiver>();
            if (_prevTarget != null && _prevTarget != _currTarget)
            {
                _prevTarget.OnEyeExit();
                _currTarget.OnEyeEnter();
                _prevTarget = _currTarget;
            }
            else if (_prevTarget == null)
            {
                _currTarget.OnEyeEnter();
                _prevTarget = _currTarget;
            }
        }
        else if (_prevTarget != null)
        {
            _prevTarget.OnEyeExit();
            _prevTarget = null;
        }
    }
コード例 #2
0
 private void FixedUpdate()
 {
     Ray ray = new Ray(headTransform.position + headTransform.up * upOffset,
                         headTransform.forward);
     RaycastHit hit;
     if (Physics.Raycast(ray, out hit, range, raycastLayerMask) &&
         hit.collider.GetComponent<RaycastReceiver>() != null &&
         !(hit.collider.GetComponent<MeshRenderer>() != null && !hit.collider.GetComponent<MeshRenderer>().isVisible)
         )
     {
         RaycastReceiver _currTarget = hit.collider.GetComponent<RaycastReceiver>();
         if (_prevTarget != null && _prevTarget != _currTarget)
         {
             _prevTarget.OnEyeExit();
             _currTarget.OnEyeEnter();
             _prevTarget = _currTarget;
         }
         else if (_prevTarget == null)
         {
             _currTarget.OnEyeEnter();
             _prevTarget = _currTarget;
         }
     }
     else if (_prevTarget != null)
     {
         _prevTarget.OnEyeExit();
         _prevTarget = null;
     }
 }
コード例 #3
0
ファイル: ExitTrigger.cs プロジェクト: byunghwl/VR_Rehearsal
 private void ReceiverEyeStared(RaycastReceiver receiver, float progress)
 {
     _mat.color = Color.Lerp(_initColor, Color.white, progress);
     if (progress >= 1f)
     {
         OnExit.Invoke();
     }
 }
コード例 #4
0
ファイル: ExitTrigger.cs プロジェクト: byunghwl/VR_Rehearsal
 private void ReceiverEyeExited(RaycastReceiver receiver)
 {
     _mat.color = _initColor;
 }
コード例 #5
0
 private void ReceiverEyeStared(RaycastReceiver receiver, float progress)
 {
     _mat.color = Color.Lerp(_initColor, Color.white, progress);
     if (progress >= 1f)
         OnExit.Invoke();
 }
コード例 #6
0
 private void ReceiverEyeExited(RaycastReceiver receiver)
 {
     _mat.color = _initColor;
 }