예제 #1
0
파일: Drawable.cs 프로젝트: DejvB/Brush-It
        private void EndGame()
        {
            King = -1;
            int j = 0;

            percheck = new int[NumberOfPlayers];
            //foreach (int item in percentage) { max = max < item ? item : max;}
            for (int i = 0; i < percentage.Length; i++)
            {
                j = percentage[j] < percentage[i] ? i : j;
            }                                                                                          // the loop is redundant, leader is the first one
            for (int i = 0; i < percentage.Length; i++)
            {
                percentageStats[i] = (float)percentage[i] / sum;
            }
            Panel.gameObject.SetActive(true);
            colors[j].a = 255;
            // In case of not tournament, uncomment this
            try
            {
                GameObject.Find("Winner").GetComponent <Image>().color = colors[j];
                Percent.text = "With " + (System.Math.Round(100.0 * percentage[j] / sum, 2)).ToString() + " %";
            }
            catch (Exception e) { }
            Time.timeScale = 0.000000f;
            if (!GameSetting.AI[j])
            {
                ButtonScript.SaveData(NumberOfPlayers, (float)percentage[j] / sum);
            }
            joystick.gameObject.SetActive(false);
            sw.Start();
            //StatsCheck();
            sw.Stop();
            Debug.Log(sw.Elapsed.ToString());
        }