Ejemplo n.º 1
0
    //! Network functions called once per frame.
    public void NetworkFrame()
    {
        serverURL = PlayerPrefs.GetString("serverURL");

        string commandLineOptions = Environment.CommandLine;

        if (commandLineOptions.Contains("-batchmode"))
        {
            if (dedicatedServerCoroutineBusy == false)
            {
                dedicatedServerCoroutine = playerController.StartCoroutine(DedicatedServerCoroutine());
            }
        }

        if (sendNetworkPlayerCoroutineBusy == false)
        {
            sendNetworkPlayerCoroutine = playerController.StartCoroutine(SendNetworkPlayerInfo());
        }

        if (getNetworkPlayersCoroutineBusy == false)
        {
            getNetworkPlayersCoroutine = playerController.StartCoroutine(GetNetworkPlayers());
        }

        if (playerMovementCoroutineBusy == false)
        {
            networkMovementCoroutine = playerController.StartCoroutine(MoveNetworkPlayers());
        }

        if (networkBlockCoroutineBusy == false)
        {
            networkBlockCoroutineBusy = true;
            networkBlockCoroutine     = playerController.StartCoroutine(UpdateNetworkBlocks());
        }

        if (networkItemCoroutineBusy == false)
        {
            networkItemCoroutineBusy = true;
            networkItemCoroutine     = playerController.StartCoroutine(UpdateNetworkItems());
        }

        if (announceCoroutineBusy == false && PlayerPrefsX.GetPersistentBool("hosting") == true && PlayerPrefsX.GetPersistentBool("announce") == true)
        {
            announceCoroutineBusy = true;
            announceCoroutine     = playerController.StartCoroutine(networkSend.Announce());
        }

        if (checkForBanCoroutineBusy == false && PlayerPrefsX.GetPersistentBool("hosting") == false)
        {
            checkForBanCoroutineBusy = true;
            checkForBanCoroutine     = playerController.StartCoroutine(networkReceive.CheckForBan());
        }
    }