Example #1
0
        private void TakePhotograph()
        {
            soundManager.PlayCamera();
            Texture2D picture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);

            Camera        mainCamera        = Camera.main;
            RenderTexture tempRenderTexture = RenderTexture.GetTemporary(Screen.width, Screen.height, 24, RenderTextureFormat.ARGB32);

            mainCamera.enabled              = false;
            photographyCamera.enabled       = true;
            photographyCamera.targetTexture = tempRenderTexture;
            photographyCamera.Render();
            RenderTexture.active = tempRenderTexture;
            Rect photoRect = new Rect(0, 0, Screen.width, Screen.height);

            picture.ReadPixels(photoRect, 0, 0, false);
            picture.Apply();

            mainCamera.enabled        = true;
            photographyCamera.enabled = false;

            RenderTexture.active = null;
            RenderTexture.ReleaseTemporary(tempRenderTexture);

            ScoringPicture scoringPicture = new ScoringPicture();

            scoringPicture.ScorePhoto(picture, photographyCamera, allFish);


            photoPanel.AddPhoto(scoringPicture);

            photoPanel.ShowPanel();
        }
    public void AddPhoto(ScoringPicture photo)
    {
        Debug.Log("Adding photo " + photo.picture.width + " x " + photo.picture.height + " score: " + photo.GetScore());
        Debug.Log("Canvas Renderer : " + photo1Renderer);

        lastPicture              = photo;
        newImage.color           = Color.white;
        newImage.texture         = photo.picture;
        newPhotoDescription.text = photo.GetFishNames();
        newScore.text            = "" + photo.GetScore();
    }
 public void OnClickSave3()
 {
     photo3 = lastPicture;
     ShowPictures();
 }
 public void OnClickSave2()
 {
     photo2 = lastPicture;
     ShowPictures();
 }
 public void OnClickSave1()
 {
     photo1 = lastPicture;
     ShowPictures();
 }