Exemple #1
0
        // 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);
            }
        }
Exemple #2
0
        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);
                }
            }
        }
Exemple #3
0
 void Update()
 {
     for (int playerIndex = 0; playerIndex < m_Players.Count; ++playerIndex)
     {
         WiFiPlayerInput playerInput = m_Players[playerIndex];
         if (playerInput != null)
         {
             if (playerInput.isActive)
             {
                 playerInput.Update();
             }
         }
     }
 }
Exemple #4
0
 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);
 }
Exemple #5
0
        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);
                    }
                }
            }
        }