public void TakePhoto(OnPhotoTakenCallback callback) { // Create a PhotoCapture object PhotoCapture.CreateAsync(false, delegate(PhotoCapture captureObject) { this.photoCaptureObject = captureObject; CameraParameters cameraParameters = new CameraParameters { hologramOpacity = 0.0f, cameraResolutionWidth = this.cameraResolution.width, cameraResolutionHeight = this.cameraResolution.height, pixelFormat = CapturePixelFormat.BGRA32 }; // Activate the camera photoCaptureObject.StartPhotoModeAsync(cameraParameters, delegate(PhotoCapture.PhotoCaptureResult result) { // Take a picture photoCaptureObject.TakePhotoAsync((photoCaptureResult, photoCaptureFrame) => { photoCaptureFrame.UploadImageDataToTexture(photo); if (callback != null) { callback.Invoke(photo, cameraResolution); } this.photoCaptureObject.StopPhotoModeAsync(OnStoppedPhotoMode); }); }); }); }
IEnumerator TakePhoto(OnPhotoTakenCallback callback) { yield return(new WaitForSeconds(photoDelay)); audioSource.PlayOneShot(PhotoSound, photoVolume); /* * currentPhoto = CameraStream.Instance.Frame; * * if (callback != null) { * callback.Invoke(currentPhoto); * } */ }
public void Photo(OnPhotoTakenCallback callback) { StartCoroutine(TakePhoto(callback)); }