Пример #1
0
    // Start is called before the first frame update
    IEnumerator Start()
    {
        yield return(StartCoroutine(menuUIManager.FadeIn(1)));

        GameData.playerData = new List <PlayerData>();
        for (int i = 0; i < roombaPlayer.Length; i++)
        {
            // Every time a player joins and confirms his participation, we add him in the playerdata with his choice
            roombaPlayer[i].OnRoombaReady += AddPlayerRoomba;
            roombaPlayer[i].OnGameStart   += OnGameStart;
        }

        // Wait until all the connected players have choosen and confirmed a microwave
        while (GameData.playerData.Count < roombaPlayer.Length && !_gameStart)
        {
            yield return(null);
        }
        sfxROOOOMBAAAH.Play();
        yield return(new WaitForSeconds(1f));

        yield return(StartCoroutine(menuUIManager.FadeOut(1)));

        SceneManager.LoadScene(1);
        //LoadScene;
    }
Пример #2
0
    IEnumerator Start()
    {
        yield return(StartCoroutine(menuUIManager.FadeIn(1)));

        foreach (PlayerData playerData in GameData.playerData)
        {
            GameObject scoreBar = scoreBars[playerData.playerId];
            scoreBar.GetComponent <Image>().color = playerData.graphics.trailColor;
            scoreBar.transform.parent.gameObject.SetActive(true);
            float         tweenDuration = scoreTweenDurationMax * playerData.tilesCleanedPercentage;
            RectTransform rectTransform = scoreBar.GetComponent <RectTransform>();
            rectTransform.DOSizeDelta(new Vector2(rectTransform.rect.width, scoreBarHeightMax * playerData.tilesCleanedPercentage), tweenDuration);
            StartCoroutine(scoreBar.GetComponentInChildren <ScoreLabelController>().CountTo(Mathf.RoundToInt(playerData.tilesCleanedPercentage * 10000) / 100f, tweenDuration));
        }
        yield return(new WaitForSeconds(10f));

        yield return(StartCoroutine(menuUIManager.FadeOut(1)));

        SceneManager.LoadScene(0);
    }