Example #1
0
 public void Initialize(int seatIndex)
 {
     m_SeatIndex    = seatIndex;
     m_State        = CharSelectData.SeatState.Inactive;
     m_PlayerNumber = -1;
     ConfigureStateGraphics();
 }
        /// <summary>
        /// Internal utility that sets the character-graphics and class-info box based on
        /// our chosen seat. It also triggers a LobbyMode change when it notices that our seat-state
        /// is LockedIn.
        /// </summary>
        /// <param name="state">Our current seat state</param>
        /// <param name="seatIdx">Which seat we're sitting in, or -1 if SeatState is Inactive</param>
        private void UpdateCharacterSelection(CharSelectData.SeatState state, int seatIdx = -1)
        {
            bool isNewSeat = m_LastSeatSelected != seatIdx;

            m_LastSeatSelected = seatIdx;
            if (state == CharSelectData.SeatState.Inactive)
            {
                m_InSceneCharacter.gameObject.SetActive(false);
                m_ClassInfoBox.ConfigureForNoSelection();
            }
            else
            {
                m_InSceneCharacter.gameObject.SetActive(true);
                m_InSceneCharacter.SwapToModel(CharSelectData.LobbySeatConfigurations[seatIdx].CharacterArtIdx);
                m_ClassInfoBox.ConfigureForClass(CharSelectData.LobbySeatConfigurations[seatIdx].Class);
                if (state == CharSelectData.SeatState.LockedIn && !m_HasLocalPlayerLockedIn)
                {
                    // the local player has locked in their seat choice! Rearrange the UI appropriately

                    // the character should act excited
                    m_InSceneCharacterAnimator.SetTrigger(m_AnimationTriggerOnCharChosen);

                    ConfigureUIForLobbyMode(CharSelectData.IsLobbyClosed.Value ? LobbyMode.LobbyEnding : LobbyMode.SeatChosen);

                    m_HasLocalPlayerLockedIn = true;
                }
                else if (state == CharSelectData.SeatState.Active && isNewSeat)
                {
                    m_InSceneCharacterAnimator.SetTrigger(m_AnimationTriggerOnCharSelect);
                }
            }
        }
Example #3
0
 public void SetState(CharSelectData.SeatState state, int playerIndex, string playerName)
 {
     if (state == m_State && playerIndex == m_PlayerNumber)
     {
         return; // no actual changes
     }
     m_State                 = state;
     m_PlayerNumber          = playerIndex;
     m_PlayerNameHolder.text = playerName;
     if (m_State == CharSelectData.SeatState.Inactive)
     {
         m_PlayerNumber = -1;
     }
     ConfigureStateGraphics();
 }