Beispiel #1
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject gameManager = GameObject.Find("GameManager");

        sceneHistory = gameManager.GetComponent <SceneHistory>();
        sceneHistory.LoadScene(sceneToLoad);
    }
Beispiel #2
0
 protected override void Awake()
 {
     base.Awake();
     if (Application.isPlaying)
     {
         onClick.AddListener(() => SceneHistory.LoadScene(RythmGameSettings.GameMode.gameScene));
     }
 }
Beispiel #3
0
    private void Update()
    {
        if (voteIsRunning && Time.time > timeVoteStarted + defaultVoteTime)
        {
            voteIsRunning = false;
            TwitchClient.Instance.OnMessageReceived -= VoteHandler;

            int winnerID = 0;
            for (int i = 1; i < songVotes.Length; ++i)
            {
                if (songVotes[i] > songVotes[winnerID])
                {
                    winnerID = i;
                }
            }
            float winnerDifficulty = (float)difficultyCumulatedVotes / votesCount;

            TwitchClient.Instance.SendMessage("Vote has ended, thanks for your participation !");
            TwitchClient.Instance.SendMessage($"Song {choices[winnerID].Id} with difficulty {System.Math.Round(winnerDifficulty, 1)} have been choosen !");
            NotificationManager.Instance.PushNotification("Vote has ended", Color.white, Color.blue);

            RythmGameSettings.BeatmapToLoad = choices[winnerID].Song.BeatmapContainer;
            RythmGameSettings.Difficulty    = winnerDifficulty;
            SceneHistory.LoadScene("TwitchMode");
        }

        if (voteIsRunning)
        {
            for (int i = 0; i < choices.Length; ++i)
            {
                if (Input.GetKeyDown(KeyCode.A + i))
                {
                    songVotes[i]++;
                    difficultyCumulatedVotes += Random.Range(1, 5);
                    votesCount++;
                    Debug.Log(difficultyCumulatedVotes / (float)votesCount);
                }
            }

            if (votesCount != 0)
            {
                for (int i = 0; i < choices.Length; ++i)
                {
                    choices[i].Percentage = (float)songVotes[i] / votesCount;
                }
                DifficultyCursor.Difficulty = (float)difficultyCumulatedVotes / votesCount;
            }
        }
    }
 protected override void Awake()
 {
     base.Awake();
     onClick.AddListener(() => SceneHistory.LoadScene(ScenePath));
 }