コード例 #1
0
    // [Server] Loads this MatchManager's config from the MatchSetupController's final config.
    private IEnumerator LoadMatchConfigCoroutine(MatchSetupController controller)
    {
        Debug.Log(debugTag + "Grabbing config from MatchSetupController...");

        while (!controller.Ready)
        {
            yield return(null);
        }

        this.config = controller.InitialConfig;
        Debug.Log(debugTag + "Config loaded! Sending to Broadcaster...");
        matchDataBroadcaster.MatchConfigStr = JsonUtility.ToJson(controller.InitialConfig);
    }
コード例 #2
0
    // [Server] Loads the config from MatchSetupController and initializes the match.
    private void InitializeMatch()
    {
        GrabMatchDataBroadCaster();
        GrabGridController();

        // TODO: Wrap this in a method like data broadcaster
        this.matchConnections = GameObject.Find("NetworkManager").GetComponent <MatchConnections>();

        GameObject matchSetupManager = GameObject.Find("SetupManager");

        if (matchSetupManager != null)
        {
            Debug.Log(debugTag + "SetupManager (our dad) was found!");

            MatchSetupController setupController = matchSetupManager.GetComponent <MatchSetupController>();
            StartCoroutine(LoadMatchConfigCoroutine(setupController));
            StartCoroutine(InitializeMatchCoroutine());
        }
        else
        {
            Debug.LogError(debugTag.error + "SetupManager (our dad) was NOT found!");
        }
    }