/**
         * Analyze scorable view, create virtual screenshot, read pixels, analyse pixels, read score, trigger ScoreArea.ChangeScore() in a coroutine
         *
         * @param scoreArea ScoreArea to analyze
         * @param renderer Renderer of score area
         * @param cam Main Camera
         */
        public IEnumerator AnalyzeScoreableView(ScoreArea scoreArea, Renderer sceneRenderer, Camera cam)
        {
            var bounds = sceneRenderer.bounds;
            // get dimensions of Score Area
            var size = cam.WorldToScreenPoint(bounds.max);
            // get position and transform to screen point
            var position = cam.WorldToScreenPoint(bounds.min);
            // create texture to store "screenshot" in
            var img = new Texture2D((int)(size.x - position.x), (int)(size.y - position.y), TextureFormat.RGB24,
                                    false);
            // create rectengular at score area
            var rect = new Rect((Vector2)position, (Vector2)(size - position));

            // wait for frame ot be rendered
            yield return(new WaitForEndOfFrame());

            // create the image
            img.ReadPixels(rect, 0, 0);
            img.Apply();
            //byte[] toPNG = img.EncodeToPNG();
            //System.IO.File.WriteAllBytes("./screenshot.png", toPNG);
            var pixels = img.GetPixels();
            //analyze pixels
            AnalyzeScoreAreaResult result = AnalyzePixelMap(pixels);
            //calculate score
            var score = CalculateScore(result);

            scoreArea.HandleScore(score);
            yield return(null);
        }
 /**
  * Changes to the End- and Creditsscene
  */
 public void LoadEndScene()
 {
     scoreArea1 = GameObject.Find("Team_1/ScoreArea").GetComponent <ScoreArea.ScoreArea>();
     scoreArea2 = GameObject.Find("Team_2/ScoreArea").GetComponent <ScoreArea.ScoreArea>();
     ScoreTeam1 = scoreArea1.TeamScore;
     ScoreTeam2 = scoreArea2.TeamScore;
     SceneManager.LoadScene("Scenes/Scene_End");
 }
 /**
  * put stone in Score area
  *
  * @param stone
  * @param scoreArea
  */
 public static void StoneToScoreArea(Stone stone, ScoreArea.ScoreArea scoreArea)
 {
     stone.SetParent(scoreArea.gameObject);
     scoreArea.AddStone(stone);
 }