Beispiel #1
0
    void checkReady()
    {
        if (NumOfPlayers == NumOfPlayersReady)
        {
            int  rNum = Random.Range(0, 100), x = 0;
            bool finding = true;

            while (finding)
            {
                if (rNum > 75 && LockedIn [3])
                {
                    if (ES.CheckLevelWins(3) > 0)
                    {
                        ES.ChangeLevelWins(3, -1);
                    }
                    else
                    {
                        x = 3;
                        ES.ChangeLevelWins(3, 1);
                        finding = false;
                    }
                }
                else if (rNum > 50 && rNum < 75 && LockedIn [2])
                {
                    if (ES.CheckLevelWins(2) > 0)
                    {
                        ES.ChangeLevelWins(2, -1);
                    }
                    else
                    {
                        x = 2;
                        ES.ChangeLevelWins(2, 1);
                        finding = false;
                    }
                }
                else if (rNum > 25 && rNum < 50 && LockedIn [1])
                {
                    if (ES.CheckLevelWins(1) > 0)
                    {
                        ES.ChangeLevelWins(1, -1);
                    }
                    else
                    {
                        x = 1;
                        ES.ChangeLevelWins(1, 1);
                        finding = false;
                    }
                }
                else if (rNum > 0 && rNum < 25 && LockedIn [0])
                {
                    if (ES.CheckLevelWins(0) > 0)
                    {
                        ES.ChangeLevelWins(0, -1);
                    }
                    else
                    {
                        x = 0;
                        ES.ChangeLevelWins(0, 1);
                        finding = false;
                    }
                }

                rNum = Random.Range(0, 100);
            }
            LevelToLoad = PlayerVote[x] + 4;
            AnimObjs [PlayerVote[x]].SetActive(true);

            Component[] PickedStageParts;
            PickedStageParts = AnimObjs[PlayerVote[x]].GetComponentsInChildren <Image> ();
            foreach (Image UIAnim in PickedStageParts)
            {
                UIAnim.color = ES.GetColor(x);
            }

            StartCoroutine(LevelTransitionAnimation());
            Invoke("TransitionSound", .5f);
            Invoke("StartNextLevel", 3f);
        }
    }