Пример #1
0
    private IEnumerator SetupGame(int x)
    {
        yield return(new WaitForSecondsRealtime(x));

        // Signal AnimationController to spawn chef prefabs
        spawnChefs = true;

        // Load settings from the main menu
        if (isServer)
        {
            LoadSettings();
        }

        // Create list of players
        var players = FindObjectsOfType <Player>();

        // Initialise players
        int playerIndex = 0;

        foreach (Player p in players)
        {
            playerList.Add(p);
            if (isServer)
            {
                p.SetGameController(this);
            }
            p.SetInstructionController(InstructionController);
            p.SetPlayerId(playerIndex);
            p.instStartTime = CalculateInstructionTime();
            p.playerCount   = playerCount;
            p.PlayerScore   = 0;
            if (!easyPhoneInteractions)
            {
                p.DisableOkayButtonsOnPanels();
            }

            // Display Chefs on Duty on central server screen
            if (isServer)
            {
                UserNames.Add(p.PlayerUserName);
                playerNames[playerIndex].text  = p.PlayerUserName;
                playerNames[playerIndex].color = p.PlayerColour;
            }
            playerIndex++;
        }

        PlayersInitialisedFromStart();

        InstructionController.ICStart(playerCount, numberOfButtons, playerList, this);

        if (isServer)
        {
            // Instantiate GameStateHandler object on the server to hold gamestate data
            gameStateHandler = new GameStateHandler(UserNames);

            // Begin gameplay sequence
            StartCoroutine(RoundCountdown(10, "3"));
            StartCoroutine(RoundCountdown(11, "2"));
            StartCoroutine(RoundCountdown(12, "1"));
            StartCoroutine(StartRound(13));
            StartCoroutine(StartGame(13));
        }
    }