Exemple #1
0
        // Update is called once per frame
        void Update()
        {
            if (!startPlaying)
            {
                if (Input.anyKeyDown)
                {
                    //Invoke("setStartPlaying", songs[songIndex].GetComponent<Song>().offsetInSeconds);
                    this.startPlaying = true;
                    songs[songIndex].GetComponent <AudioSource>().Play();
                    //DANCE
                    GameEventSystem.current.StartDance();
                    Pulse.play();
                    Destroy(PressStartPrompt, 0f);
                }
            }

            if (!songs[songIndex].GetComponent <AudioSource>().isPlaying&& startPlaying && !stoppedOnEnd)
            {
                stoppedOnEnd = true;
                Pulse.stop();
                if (!stoppedDancing)
                {
                    GameEventSystem.current.StopDance();
                    stoppedDancing = true;
                }
                var scores = new List <(int, int)>();
                scores.Add((1, player1.GetComponent <Score>().score));
                scores.Add((2, player2.GetComponent <Score>().score));
                scores.Add((3, player3.GetComponent <Score>().score));
                scores.Add((4, player4.GetComponent <Score>().score));

                // Highest score first
                scores.Sort(delegate((int, int)p1, (int, int)p2)
                {
                    return(p2.Item2.CompareTo(p1.Item2));
                });