private void UpdateRaycast() { Ray ray = new Ray(transform.position, transform.forward); RaycastHit hit; bool bHit = Physics.Raycast(ray, out hit); if (_previousTarget && _previousTarget != hit.transform) { RayPointEventArgs argsOut = new RayPointEventArgs(); argsOut.distance = 0; argsOut.device = device_; argsOut.target = _previousTarget; OnPointOut(argsOut); _previousTarget = null; } if (bHit && _previousTarget != hit.transform) { RayPointEventArgs argsIn = new RayPointEventArgs(); argsIn.distance = hit.distance; argsIn.device = device_; argsIn.target = hit.transform; OnPointIn(argsIn); _previousTarget = hit.transform; } if (!bHit) { _previousTarget = null; } }
private void OnPointerOut(object sender, RayPointEventArgs e) { rayPointOut?.Invoke(e); }
private void OnPointerIn(object sender, RayPointEventArgs e) { rayPointIn?.Invoke(e); }
public void OnPointOut(RayPointEventArgs e) { pointerOut?.Invoke(this, e); }
public void OnPointIn(RayPointEventArgs e) { pointerIn?.Invoke(this, e); }