// EVENTS private void OnConnectionsChanged(bool i_IsConnect, int i_PlayerNumber) { // Notify players for (int playerIndex = 0; playerIndex < m_Players.Count; ++playerIndex) { WiFiPlayerInput playerInput = m_Players[playerIndex]; if (playerInput != null) { playerInput.OnConnectionsChanged(); } if (playerIndex == i_PlayerNumber) { playerInput.SetActive(i_IsConnect); } } // Raise event if (connectionsChangedEvent != null) { connectionsChangedEvent(i_IsConnect, i_PlayerNumber); } }
private void InternalAddAxis(WiFiControlDescriptor i_Descriptor) { string controlName = i_Descriptor.controlName; for (int playerIndex = 0; playerIndex < m_Players.Count; ++playerIndex) { WiFiPlayerInput playerInput = m_Players[playerIndex]; if (playerInput != null) { AxisServerController axisServerController = new AxisServerController(controlName, (PLAYER_NUMBER)playerIndex); playerInput.AddAxis(controlName, axisServerController); } } }
void Update() { for (int playerIndex = 0; playerIndex < m_Players.Count; ++playerIndex) { WiFiPlayerInput playerInput = m_Players[playerIndex]; if (playerInput != null) { if (playerInput.isActive) { playerInput.Update(); } } } }
public WiFiPlayerInput GetPlayerByName(string i_Name) { for (int playerIndex = 0; playerIndex < m_Players.Count; ++playerIndex) { WiFiPlayerInput playerInput = m_Players[playerIndex]; if (playerInput != null) { if (playerInput.playerName.Equals(i_Name)) { return(m_Players[playerIndex]); } } } return(null); }
private void CreatePlayers() { WiFiPlayersDatabase database = Resources.Load <WiFiPlayersDatabase>("Input/WiFi/WiFiPlayersDatabase"); if (database != null) { for (int playerIndex = 0; playerIndex < database.count; ++playerIndex) { WiFiPlayerDescriptor descriptor = database.GetPlayer(playerIndex); if (descriptor != null) { WiFiPlayerInput playerInput = new WiFiPlayerInput(descriptor); playerInput.Initialize(); playerInput.SetActive(false); m_Players.Add(playerInput); } } } }