/// <summary> /// Sets up the swap characters based on current game session conditions. /// </summary> private IEnumerator RefreshSwapCharactersInternal() { // wait till network properties are actually set yield return(new WaitForEndOfFrame()); // if player is online but NOT associated with the machine running this if (GeneralMethods.IsNetworkConnectedButNotLocalClient(_networkIdentity)) { // DONT continue code yield break; } // if playing solo //if (((NetworkManagerCustom)NetworkManager.singleton).numPlayers <= 1) //if (((NetworkManagerCustom)NetworkManager.singleton).connectedPlayers.Count <= 1) //if (NetworkServer.connections.Count <= 1) if (((NetworkManagerCustom)NetworkManager.singleton).GetNumberOfPlayerObjects() <= 1) { // get entire party List <CharacterData> partyChars = GameManager.Instance.GetPartyCharacters(); // if party has at least one member if (partyChars.Count >= 1) { // set primary char to first party member (the MC) primaryCharacter = partyChars[0]; } // else party is empty else { // set primary char to a null char primaryCharacter = null; } // set swapping chars from entire party SetupSwappableCharacterFromCharList(partyChars); } // else playing with multiple people else { // set primary char to the party char associated with this char's player number primaryCharacter = GameManager.Instance.GetPartyCharacterInPartySlot( _playerCharacterMasterController.GetPlayerNumber()); // remove all swap chars from list as will only use the default char in multiplayer swappableCharacters = new List <CharacterData>(); } // sets the main and secondary character data based on changes made RefreshCharData(); RefreshCharDataSecondary(); }
private IEnumerator SetupMenuForJoinerIfAppropriateInternal(PlayerCharacterMasterController joiningCharArg) { // wait for network properties to be setup yield return(new WaitForEndOfFrame()); // if joining player is NOT the host (who should already be in this menu) if (joiningCharArg.GetPlayerNumber() != 1) { // open haven menu's main menu SwitchToStartingMenu(); // turn off multiplayer button to prevent access multiplayerMenuButton.SetActive(false); } else { // turn on multiplayer button to allow access multiplayerMenuButton.SetActive(true); } }