Esempio n. 1
0
    public void TransferToMatchScene()
    {
        if (PhotonNetwork.IsMasterClient == false)
        {
            Debug.LogError("A non-master tried to move directly to match - ignoring");
            return;
        }
        else if (ArePlayersConnected() == false)
        {
            Debug.LogError("Tried to move to directly to match when not all characters are connected");
            return;
        }
        else if (NetworkMatchSetup.HasAllMatchSetupInfo() == false)
        {
            Debug.LogError("MatchSetup is not filled out enough to start a match");
            return;
        }

        if (SceneManager.GetActiveScene().name == "_MATCH")
        {
            Debug.Log("We're already in the _MATCH scene, so no need to transfer to it");
        }
        else
        {
            Debug.Log(NetworkMatchSetup.MatchSetupToString());
            Debug.Log("We as the master are moving us to the Match scene");
            PhotonNetwork.LoadLevel("_MATCH");
        }
    }
Esempio n. 2
0
    public IEnumerator SetupMatch()
    {
        while (NetworkMatchSetup.HasAllMatchSetupInfo() == false)
        {
            //Spin until we have all the match setup info that we need to start the match
            yield return(null);
        }

        while (NetworkMatchSender.Get() == null)
        {
            //Spin until the needed networking objects have been spawned and given a chance to initialize
            // - in particular, the NetworkMatchSender needs to be ready in case we need to immediately send inputs
            //    as part of initializing the match (like for loading a log file)
            yield return(null);
        }

        Debug.Log("Starting match initializations since we have enough information");

        ContRandomization.Get().InitGenerator(NetworkMatchSetup.GetRandomizationSeed());

        Debug.Log("Finished initializing the randomizer");

        InitPlayers(nPlayers);

        Debug.Log("Finished initializing players");

        //Initialize characters
        InitAllChrs();

        Debug.Log("After InitAllChrs");

        //Assign local input controllers for each player
        AssignAllLocalInputControllers();

        Debug.Log("After assigning local input controllers");

        ContManaDistributer.Get().InitializeRandomReserves();

        Debug.Log("After initializing mana reserves");

        InitAllChrPositions();

        Debug.Log("After initializing positions");

        //ContPositions.Get().PrintAllPositions();

        ContTurns.Get().InitializePriorities();

        Debug.Log("After InitializePriorities");

        //Check if the LogManager wants to load in any starting inputs
        LogManager.Get().LoadStartingInputs();

        Debug.Log("After LoadStartingInputs");

        LogManager.Get().InitMatchLog();

        Debug.Log("Finished initializing the log file");
    }